GLNORMALPOINTER(3G)

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

πŸ’– GLNORMALPOINTER(3G) πŸ’–

okay bestie, welcome to the glNormalPointer page from the 3G manual section β€” yes it's the OpenGL girlies' corner of the docs and we're gonna get you fluent in normals, no cap ✨


✨ NAME ✨

glNormalPointer β€” define an array of normals 🌸 (yes that's the whole job, she's focused, she's serving)


πŸŽ€ C SPECIFICATION πŸŽ€

void glNormalPointer( GLenum type,
                      GLsizei stride,
                      const GLvoid *ptr )

three args, that's it, she's low maintenance πŸ’…


πŸ¦‹ PARAMETERS πŸ¦‹

  • type β€” the data type of each coordinate in the array. The accepted symbolic constants are GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, and GL_DOUBLE. The initial value is GL_FLOAT.
  • stride β€” the byte offset between consecutive normals. If stride is 0 β€” which is the initial value β€” the normals are understood to be tightly packed in the array. The initial value is 0.
  • ptr β€” a pointer to the first coordinate of the first normal in the array. The initial value is 0.

🌈 DESCRIPTION 🌈

so basically glNormalPointer specifies the location and data of an array of normals to use when rendering. type specifies the data type of the normal coordinates, and stride gives the byte stride from one normal to the next β€” which is the whole reason you can pack vertices and attributes into a single array, or keep them in separate arrays. (heads up: single-array storage may be more efficient on some implementations; see glInterleavedArrays.) And when a normal array is specified, type, stride, and ptr get saved as client-side state. periodt πŸ’…

To enable and disable the normal array, you call glEnableClientState and glDisableClientState with the argument GL_NORMAL_ARRAY. If it's enabled, the normal array gets used when glDrawArrays, glDrawElements, or glArrayElement is called. πŸ‘‘

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 different girlies, three different strategies, all iconic 🫢


⭐ NOTES ⭐

  • glNormalPointer is available only if the GL version is 1.1 or greater. so if you're on something older... not me being the bearer of bad news 😭
  • The normal array is initially disabled and isn't accessed when glArrayElement, glDrawElements, or glDrawArrays is called.
  • > bestie listen. Execution of glNormalPointer is not allowed between glBegin and the corresponding glEnd, but an error may or may not be generated. If an error is not generated, the operation is undefined. that's the scary kind of undefined, not the fun kind πŸ’€
  • glNormalPointer is typically implemented on the client side.
  • Since the normal array parameters are client-side state, they are not saved or restored by glPushAttrib and glPopAttrib. Use glPushClientAttrib and glPopClientAttrib instead. wrong function, wrong energy, we don't do that here πŸ™ˆ

πŸ’€ ERRORS πŸ’€

  • GL_INVALID_ENUM is generated if type is not an accepted value.
  • GL_INVALID_VALUE is generated if stride is negative.

(negative stride? in this economy? no ma'am. it's giving invalid value fr fr)


πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glIsEnabled with argument GL_NORMAL_ARRAY
  • glGet with argument GL_NORMAL_ARRAY_TYPE
  • glGet with argument GL_NORMAL_ARRAY_STRIDE
  • glGetPointerv with argument GL_NORMAL_ARRAY_POINTER

the receipts, the proof, the vibe check 🌸


πŸ‘‘ SEE ALSO πŸ‘‘

glArrayElement(3G), glColorPointer(3G), glDrawArrays(3G), glDrawElements(3G), glEdgeFlagPointer(3G), glEnable(3G), glGetPointerv(3G), glIndexPointer(3G), glInterleavedArrays(3G), glPopClientAttrib(3G), glPushClientAttrib(3G), glTexCoordPointer(3G), glVertexPointer(3G)

the whole pointer friend group, all linked, all slaying πŸ§šπŸ’œ


and that's the page!! this is the GLNORMALPOINTER(3G) entry, straight out of the 3G manual β€” it's the one with no date on it, just the title chillin' at the bottom, so consider this your official sign-off: GLNORMALPOINTER(3G), and yes, she ate πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from