GLARRAYELEMENT(3G)
π GLARRAYELEMENT β bestie's guide to rendering one vertex at a time (3G manual, obvi)
okay so this is the page for glArrayElement from the 3G manual section, and it's genuinely iconic once you get it, let me walk you through it π«Ά
β¨ NAME β¨
glArrayElement β render a vertex using the specified vertex array element πΈ
π C SPECIFICATION π
void glArrayElement( GLint i )
π PARAMETERS π
iβ this is the index into the enabled vertex data arrays. that's it, that's the whole vibe π
π DESCRIPTION π
so glArrayElement commands get used inside glBegin/glEnd pairs, and their whole job is specifying vertex and attribute data for point, line, and polygon primitives. periodt β¨
here's the tea: if GL_VERTEX_ARRAY is enabled when glArrayElement is called, a single vertex gets drawn, using vertex and attribute data taken from location i of the enabled arrays. just one. one lil vertex. but if GL_VERTEX_ARRAY is not enabled, no drawing happens at all β but the attributes corresponding to the enabled arrays still get modified. so like, sneaky little state change, no art, no cap π
the point of glArrayElement is that you construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. because each call specifies only a single vertex, you can explicitly specify per-primitive attributes β like, say, a single normal per individual triangle. main character energy for real π
β οΈ okay this next part is important, don't skip it bestie. changes made to array data between the execution ofglBeginand the corresponding execution ofglEndmay affect calls toglArrayElementthat are made within the sameglBegin/glEndperiod in non-sequential ways. meaning: a call toglArrayElementthat precedes a change to array data may access the changed data, and a call that follows a change to array data may access original data. it's giving chaos, and it's by design π
π NOTES π
glArrayElementis available only if the GL version is1.1or greater. no earlier GL, no function, sorry bestie πglArrayElementis included in display lists. ifglArrayElementis entered into a display list, the necessary array data (determined by the array pointers and enables) is also entered into the display list. so the data comes along for the ride π¦- because the array pointers and enables are client-side state, their values affect display lists when the lists are created, not when the lists are executed. lowkey the most important sentence here, write it on your mirror β
π₯ SEE ALSO π₯
glClientActiveTextureARB(3G)glColorPointer(3G)glDrawArrays(3G)glEdgeFlagPointer(3G)glGetPointerv(3G)glIndexPointer(3G)glInterleavedArrays(3G)glNormalPointer(3G)glTexCoordPointer(3G)glVertexPointer(3G)
and that's the whole page, bestie π this was GLARRAYELEMENT from the 3G manual β yes, the same name at the top and the bottom, she's consistent like that π
go index some vertices, you're gonna slay π
π¦ 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