GLVERTEXPOINTER(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’– 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 be 2, 3, or 4. the initial value is 4. don't get creative, she will not accept it πŸ™ˆ
  • type β€” the data type of each coordinate in the array. the accepted symbolic constants are GL_SHORT, GL_INT, GL_FLOAT, and GL_DOUBLE. the initial value is GL_FLOAT.
  • stride β€” the byte offset between consecutive vertices. if stride is 0, the vertices are understood to be tightly packed in the array. the initial value is 0.
  • ptr β€” a pointer to the first coordinate of the first vertex in the array. the initial value is 0.

πŸ¦‹ 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 πŸ‘‘

  • glVertexPointer is available only if the GL version is 1.1 or greater. check your version bestie.
  • the vertex array is initially disabled and isn't accessed when glArrayElement, glDrawElements or glDrawArrays is called.
⚠️ execution of glVertexPointer is not allowed between the execution of glBegin and the corresponding execution of glEnd, 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 😭
  • glVertexPointer is typically implemented on the client side.
  • vertex array parameters are client-side state and are therefore not saved or restored by glPushAttrib and glPopAttrib. use glPushClientAttrib and glPopClientAttrib instead. she does not ride with the attrib stack, she rides with the client attrib stack πŸ’œ

πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE is generated if size is not 2, 3, or 4.
  • GL_INVALID_ENUM is generated if type is is not an accepted value.
  • GL_INVALID_VALUE is generated if stride is negative.

(and yes, the original really does say "is is" β€” we keep the facts exactly as they are, typos and all 🫢)


πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glIsEnabled with argument GL_VERTEX_ARRAY
  • glGet with argument GL_VERTEX_ARRAY_SIZE
  • glGet with argument GL_VERTEX_ARRAY_TYPE
  • glGet with argument GL_VERTEX_ARRAY_STRIDE
  • glGetPointerv with argument GL_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