STREAM1 | DYNAMIC1 | STATIC1 | |
DRAW1 | GL_STREAM_DRAW | GL_DYNAMIC_DRAW | GL_STATIC_DRAW |
READ2 | GL_STREAM_READ | GL_DYNAMIC_READ | GL_STATIC_ READ |
COPY2 | GL_STREAM_COPY | GL_DYNAMIC_COPY | GL_STATIC_COPY |
1: It is available with all OpenGL 1.5 graphics card and all the ones that support GL_ARB_vertex_buffer_object extension
2: There are none available yet; this could change with the release of nVidia G80 and ATI R600.
This function is obsolete because it comes from the immediate mode.
GLvoid glArrayElement(GLint i);
Draw the ith vertex of an array and could be used in immediate mode like this:
glColorPointer(3, GL_FLOAT, 0, Colors); glVertexPointer(3, GL_FLOAT, 0, Positions); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); glBegin(GL_TRIANGLES); glArrayElement(0); glArrayElement(1); glArrayElement(2); glEnd(); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
Witch corresponds to the following sequence of functions:
glBegin(GL_TRIANGLES); glColor3fv(Colors + 0 * 3); glVertex3fv(Positions + 0 * 3); glColor3fv(Colors + 1 * 3); glVertex3fv(Positions + 1 * 3); glColor3fv(Colors + 2 * 3); glVertex3fv(Positions + 2 * 3); glEnd();
Draw a set of geometric primitives according to an index array composed by count indexes.
GLvoid glDrawElements(GLenum mode, GLsizei count, GLenum type, GLvoid* indices) { glBegin(mode); for(GLint i = 0; i < count; ++i) glArrayElement(indices[i]); glEnd(); }
Draw a set of geometric primitives according to an index array by keeping only indexes between start and end included.
GLvoid glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid* indices) { glBegin(mode); for(GLint i = 0; i < count; ++i) if(indices[i] >= start && indices[i] <= end) glArrayElement(indices[i]); glEnd(); }
Draw a set of geometric primitives composed by count vertices starting by (and including) the first element.
GLvoid glDrawArrays(GLenum mode, GLint first, GLsizei count) { glBegin(mode); for(GLint i = 0; i < count; ++i) glArrayElement(first + i); glEnd(); }
Draw a set of geometric primitives composed by count vertices starting by (and including) the first element.
GLvoid glMultiDrawArrays(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount) { for(GLint i = 0; i < primcount; ++i) { if(count[i] > 0) glDrawArrays(mode, first[i], count[i]); } }
Draw a set of geometric primitives describe by a set of index arrays.
GLvoid glMultiDrawElements(GLenum mode, GLsizei* count, GLenum type, GLvoid** indices, GLsizei primcount) { for(GLint i = 0; i < primcount; ++i) { if(count[i]) > 0) glDrawElements(mode, count[i], type, indices[i]); } }
Specify the fixed pipeline array that we want to enable or to disable:
GLvoid glEnableClientState(GLenum array); GLvoid glDisableClientState(GLenum array);
Specify the fixed pipeline array that we want to enable or to disable:
Specify the shader pipeline array that we want to enable or disable:
GLvoid glEnableVertexAttribArray(GLuint index); GLvoid glDisableVertexAttribArray(GLuint index);
index is an identifier of attribute variable.
Since OpenGL 1.1 and GL_EXT_vertex_array and GL_ARB_vertex_buffer_object:
GLvoid glVertexPointer(GLint size, GLenum type, GLsizei stride, GLvoid* pointer); GLvoid glNormalPointer(GLenum type, GLsizei stride, GLvoid* pointer); GLvoid glColorPointer(GLint size, GLenum type, GLsizei stride, GLvoid* pointer); GLvoid glEdgeFlagPointer(GLsizei stride, GLvoid* pointer); GLvoid glTexCoordPointer(GLint size, GLenum type, GLsizei stride, GLvoid* pointer);
The function glIndexPointer is useless with Vertex Buffer Objects.
GLvoid glIndexPointer(GLenum type, GLsizei stride, GLvoid* pointer);
Since OpenGL 1.4 and GL_EXT_secondary_color :
GLvoid glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, GLvoid* pointer);
Since OpenGL 1.4 and GL_EXT_fog_coord :
GLvoid glFogCoordPointer(GLenum type, GLsizei stride, GLvoid* pointer);
The glInterleavedArrays function implicated the use of array with predefined structure which is annoying and not adapted to multitexturing or shader based rendering. It is obsolete since OpenGL 1.3 and GL_ARB_multitexture. Moreover, the VBOs solution to manage interleaved array is really better because it fixes both issues.
GLvoid glInterleavedArrays(GLenum format, GLsizei stride, GLvoid* pointer);
All attributes defined by the fixed pipeline are available in the OpenGL vertex shaders. If the user wants to send customized attributes, he can create a new attributes variable. Then, the data will be sent to the vertex shaders by using the glVertexAttribPointer function.
GLvoid glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
OpenGL ES doesn’t support fixed pipeline attributes. Consequently, it’s necessary to use customized attributes and glVertexAttribPointer for all the attributes. This approach can be used with OpenGL as well and it seems that it will be generalized in the future especially with OpenGL LM. This method increases flexibility and code sturdiness for a whole shader design. nVidia drivers are ready but not yet the ATI ones. The CTest5 class among the examples shows that difference between ATI and nVidia.
A topic is availbale on the oZone3D.Net's forums: [TUTO] OpenGL VBO.
![]() |
VBO C++ / OpenGL Code Samples / CTest Classes - (1964k)
Last update: October 6, 2006
|
![]() |
XPGL - Mesh Twister - OpenGL / VBO / GLSL - Visual C++ 6.0 Project - (1105k)
Mise à jour: 11 Octobre 2006
|