GLDRAWARRAYS(3G)

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

🌸 NAME 🌸

glDrawArrays β€” render primitives from array data. and yes bestie, you're on the GLDRAWARRAYS(3G) page, the 3G manual moment, we're in it πŸ’–

✨ C SPECIFICATION ✨

void glDrawArrays( GLenum mode,
                   GLint first,
                   GLsizei count )

πŸŽ€ PARAMETERS πŸŽ€

  • mode β€” tells the GL bestie what kind of primitives to render. The accepted symbolic constants are GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_QUAD_STRIP, GL_QUADS, and GL_POLYGON.
  • first β€” the starting index in the enabled arrays. like where the glow-up begins ✨
  • count β€” how many indices are going to be rendered. the headcount for the draw call, periodt.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays. it's giving efficiency, no cap πŸ’…

When glDrawArrays is called, it uses count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first. mode specifies what kind of primitives are constructed, and how the array elements construct those primitives. If GL_VERTEX_ARRAY is not enabled, no geometric primitives are generated. literally nothing gets drawn, bestie 😭

⚠️ Vertex attributes that are modified by glDrawArrays have an unspecified value after glDrawArrays returns. For example, if GL_COLOR_ARRAY is enabled, the value of the current color is undefined after glDrawArrays executes. Attributes that aren't modified remain well defined. so yeah, that's the drama πŸ’€

πŸ’… NOTES πŸ’…

  • glDrawArrays is available only if the GL version is 1.1 or greater. that's the requirement, bestie 🫢
  • glDrawArrays is included in display lists. If glDrawArrays is entered into a display list, the necessary array data (determined by the array pointers and enables) is also entered into the display list. 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. iykyk β€” creation time, not execution time.

πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_ENUM is generated if mode is not an accepted value. not an iconic mode, bestie.
  • GL_INVALID_VALUE is generated if count is negative. negative count is not the vibe.
  • GL_INVALID_OPERATION is generated if glDrawArrays is executed between the execution of glBegin and the corresponding glEnd. do not try to sneak this into a glBegin/glEnd situation, fr fr.

🌈 SEE ALSO 🌈

glArrayElement(3G), glColorPointer(3G), glDrawElements(3G), glDrawRangeElements(3G), glEdgeFlagPointer(3G), glGetPointerv(3G), glIndexPointer(3G), glInterleavedArrays(3G), glNormalPointer(3G), glTexCoordPointer(3G), glVertexPointer(3G)


signing off from the GLDRAWARRAYS(3G) manual page β€” 3G title energy, no date stamp on this one, just vibes and primitives πŸ’– slay.

πŸ“¦ where this page comes from