Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Offset in the prototype means that you are submitting the INDEX array in prior to this call.That should be used if you are using VBO's(Vertex Buffer Objects).Use glBindBuffer to bind the index buffer and specify an offset if needed in the next call.</p> <p>First you need to bind the buffer(Index buffer here) and you can specify from where your elements start with an 'offset'.</p> <pre><code>glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_resources.element_buffer); glDrawElements( GL_TRIANGLE_STRIP, /* mode */ 4, /* count */ GL_UNSIGNED_SHORT, /* type */ (void*)0 /* element array buffer offset */ ); </code></pre> <p>for </p> <pre><code> public static void glVertexAttribPointer( int indx, int size, int type, boolean normalized, int stride, int offset) </code></pre> <p>This means that you are submitting vertex buffer in prior to this call and you can specify the offset from where it should take with in the buffer. Please check the following link for additional help. <a href="http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2.3:-Rendering.html" rel="noreferrer">http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2.3:-Rendering.html</a></p> <p>As you expected, The both have the same reason :) .Hope this helps!</p> <p>Update: you need to create a buffer to bind it.This can be done by the following steps.</p> <pre><code> glGenBuffers(); // create a buffer object glBindBuffer(); // use the buffer glBufferData(); // allocate memory in the buffer </code></pre> <p>Check this link for creating a VBO. <a href="http://www.opengl.org/wiki/Vertex_Buffer_Object" rel="noreferrer">http://www.opengl.org/wiki/Vertex_Buffer_Object</a></p> <p>Regarding the Offset type: The offset is passed as a pointer, but the parameter is used for its integer value, so we pass an integer cast to void*.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload