GLPUSHCLIENTATTRIB(3G)

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

πŸ’… GLPUSHCLIENTATTRIB(3G) β€” the glPushClientAttrib(3G) page, bestie edition

okay so bestie, sit down, hydrate, and let me tell you about the two little functions that save your client state like it's a screenshot before you do something unhinged πŸŽ€


✨ NAME ✨

glPushClientAttrib, glPopClientAttrib β€” push and pop the client attribute stack πŸ’–


🫢 C SPECIFICATION 🫢

void glPushClientAttrib( GLbitfield mask);  1.1 )

🌸 PARAMETERS 🌸

  • 1.1 β€” Specifies a mask that indicates which attributes to save. Values for 1.1 are listed below. πŸ‘‘

πŸ¦‹ C SPECIFICATION πŸ¦‹

void glPopClientAttrib( void);  1.1 )

πŸ’œ DESCRIPTION πŸ’œ

So glPushClientAttrib takes exactly one argument: a mask that says which groups of client-state variables you want saved onto the client attribute stack. You set the bits in that mask with symbolic constants, and 1.1 is typically built by OR'ing several of those constants together. And if you're feeling maximalist? The special mask GL_CLIENT_ALL_ATTRIB_BITS saves all stackable client state. no cap, all of it ✨

Here are the symbolic mask constants and their associated GL client state β€” second column is the actual tea, aka which attributes get saved:

  • GL_CLIENT_PIXEL_STORE_BIT β€” Pixel storage modes
  • GL_CLIENT_VERTEX_ARRAY_BIT β€” Vertex arrays (and enables)

Meanwhile glPopClientAttrib restores the values of the client-state variables that were saved with the last glPushClientAttrib. Anything that wasn't saved? Left completely unchanged, minding its own business πŸ™ˆ

It is an error to push attributes onto a full client attribute stack, or to pop attributes off an empty stack. In either case the error flag gets set, and literally no other change is made to GL state. πŸ’€

Initially, the client attribute stack is empty. A blank slate. main character energy πŸ‘‘


🌈 NOTES 🌈

  • glPushClientAttrib is available only if the GL version is 1.1 or greater.
  • Not all values for GL client state can be saved on the attribute stack. For example, select and feedback state cannot be saved. 😭
  • The depth of the attribute stack depends on the implementation, but bestie, it must be at least 16. that's the floor, not the vibe.
  • Use glPushAttrib and glPopAttrib to push and restore state that's kept on the server. Only pixel storage modes and vertex array state may be pushed and popped with glPushClientAttrib and glPopClientAttrib. two different stacks, two different jobs πŸ’…
  • When the GL_ARB_multitexture extension is supported, pushing and popping client vertex array state applies to all supported texture units, and the active client texture state. ⭐

πŸ’€ ERRORS πŸ’€

  • GL_STACK_OVERFLOW is generated if glPushClientAttrib is called while the attribute stack is full.
  • GL_STACK_UNDERFLOW is generated if glPopClientAttrib is called while the attribute stack is empty.

πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glGet with argument GL_ATTRIB_STACK_DEPTH
  • glGet with argument GL_MAX_CLIENT_ATTRIB_STACK_DEPTH

πŸŽ€ SEE ALSO πŸŽ€

glColorPointer(3G), glDisableClientState(3G), glEdgeFlagPointer(3G), glEnableClientState(3G), glGet(3G), glGetError(3G), glIndexPointer(3G), glNormalPointer(3G), glNewList(3G), glPixelStore(3G), glPushAttrib(3G), glTexCoordPointer(3G), glVertexPointer(3G)


and that's the whole page, bestie 🫢 it lives in the 3G section and it's filed under GLPUSHCLIENTATTRIB(3G) β€” go push and pop responsibly, ily, mwah πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from