GLVERTEXPOINTER(3G)
π GLVERTEXPOINTER π
okay bestie, welcome to the glVertexPointer page, straight out of the 3G manual section. this is the one that tells OpenGL where your vertex data lives. grab a strawberry π and let's go.
β¨ NAME β¨
glVertexPointer β define an array of vertex data. that's it, that's the whole job, and she does it flawlessly π
πΈ C SPECIFICATION πΈ
void glVertexPointer( GLint size,
GLenum type,
GLsizei stride,
const GLvoid *ptr )
look at her. four args. no cap. iconic.
π PARAMETERS π
sizeβ how many coordinates per vertex you're packing in there. it must be2,3, or4. the initial value is4. don't get creative, she will not accept it πtypeβ the data type of each coordinate in the array. the accepted symbolic constants areGL_SHORT,GL_INT,GL_FLOAT, andGL_DOUBLE. the initial value isGL_FLOAT.strideβ the byte offset between consecutive vertices. ifstrideis0, the vertices are understood to be tightly packed in the array. the initial value is0.ptrβ a pointer to the first coordinate of the first vertex in the array. the initial value is0.
π¦ DESCRIPTION π¦
so like, glVertexPointer specifies the location and the data of an array of vertex coordinates to use when rendering. size says how many coordinates per vertex, and type says what data type those coordinates are. stride is the byte stride from one vertex to the next, which is the whole reason you can pack vertices and attributes into a single array, or keep them in totally separate arrays. (single-array storage may be more efficient on some implementations β see glInterleavedArrays.) and the moment a vertex array is specified, size, type, stride, and ptr are saved as client-side state. she remembers everything, main character energy fr fr π
to enable and disable the vertex array, you call glEnableClientState and glDisableClientState with the argument GL_VERTEX_ARRAY. if it's enabled, the vertex array gets used whenever glDrawArrays, glDrawElements, or glArrayElement is called. that's the vibe check right there.
use glDrawArrays to construct a sequence of primitives (all of the same type) from prespecified vertex and vertex attribute arrays. use glArrayElement to specify primitives by indexing vertices and vertex attributes, and glDrawElements to construct a sequence of primitives by indexing vertices and vertex attributes. three little icons, three little jobs π
π NOTES π
glVertexPointeris available only if the GL version is1.1or greater. check your version bestie.- the vertex array is initially disabled and isn't accessed when
glArrayElement,glDrawElementsorglDrawArraysis called.
β οΈ execution ofglVertexPointeris not allowed between the execution ofglBeginand the corresponding execution ofglEnd, but an error may or may not be generated. if no error is generated, the operation is undefined. literally do not do this. i'm begging π
glVertexPointeris typically implemented on the client side.- vertex array parameters are client-side state and are therefore not saved or restored by
glPushAttribandglPopAttrib. useglPushClientAttribandglPopClientAttribinstead. she does not ride with the attrib stack, she rides with the client attrib stack π
π ERRORS π
GL_INVALID_VALUEis generated ifsizeis not2,3, or4.GL_INVALID_ENUMis generated iftypeis is not an accepted value.GL_INVALID_VALUEis generated ifstrideis negative.
(and yes, the original really does say "is is" β we keep the facts exactly as they are, typos and all π«Ά)
π₯ ASSOCIATED GETS π₯
glIsEnabledwith argumentGL_VERTEX_ARRAYglGetwith argumentGL_VERTEX_ARRAY_SIZEglGetwith argumentGL_VERTEX_ARRAY_TYPEglGetwith argumentGL_VERTEX_ARRAY_STRIDEglGetPointervwith argumentGL_VERTEX_ARRAY_POINTER
β SEE ALSO β
glArrayElement(3G), glColorPointer(3G), glDrawArrays(3G), glDrawElements(3G), glDrawRangeElements(3G), glEdgeFlagPointer(3G), glEnable(3G), glGetPointerv(3G), glIndexPointer(3G), glInterleavedArrays(3G), glNormalPointer(3G), glPopClientAttrib(3G), glPushClientAttrib(3G), glTexCoordPointer(3G)
the whole friend group showed up, we love a supportive circle π
and that's the page!! this one signs off as GLVERTEXPOINTER(3G) in the 3G manual, so if you see that footer floating at the bottom of your terminal, that's just her leaving the group chat. slay, bye bestie β¨ππ¦
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms