GLINDEX(3G)

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

✨ NAME ✨

okay bestie, gather round πŸ’– this page is about glIndexd, glIndexf, glIndexi, glIndexs, glIndexub, glIndexdv, glIndexfv, glIndexiv, glIndexsv, glIndexubv β€” and what do they all do? they set the current color index. that's the whole vibe. that's the gig. slay πŸ’…

this is the GLINDEX(3G) page, and it's giving "short but iconic", so let's go 🌸


πŸŽ€ C SPECIFICATION πŸŽ€

fr fr, here's exactly how you call them:

void glIndexd( GLdouble c )
void glIndexf( GLfloat c )
void glIndexi( GLint c )
void glIndexs( GLshort c )
void glIndexub( GLubyte c);  1.1 )

🌈 PARAMETERS 🌈

  • 1.1 β€” Specifies the new value for the current color index.
no cap, the 1.1 is literally sitting right there in the original parameter text, so i'm keeping it, bestie β€” i don't make the rules, i just relay them faithfully 🫢

πŸ¦‹ C SPECIFICATION (the pointer girlies) πŸ¦‹

okay now the vector versions, they take a pointer instead:

void glIndexdv( const GLdouble *c )
void glIndexfv( const GLfloat *c )
void glIndexiv( const GLint *c )
void glIndexsv( const GLshort *c )
void glIndexubv( const GLubyte *c);  1.1 )

πŸ’œ PARAMETERS πŸ’œ

  • 1.1 β€” Specifies a pointer to a one-element array that contains the new value for the current color index.

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so the tea: glIndex updates the current (single-valued) color index. it takes one argument, and that argument is literally just the new value for the current color index. one job. done. iconic.

the current index is stored as a floating-point value. and here's the thing β€” integer values are converted directly to floating-point values, with no special mapping. none. zero. it's just a straight-up conversion, no glow-up in between. also: the initial value is 1. remember that 🧚

now for the spicy part 🌢️ β€” index values outside the representable range of the color index buffer are not clamped. not even a little. however (and this is the important however), before an index is dithered (if enabled) and written to the frame buffer, it is converted to fixed-point. and then β€” any bits in the integer portion of that resulting fixed-point value that do not correspond to bits in the frame buffer are masked out. so yeah, stuff gets cut off at the end, but not at the start. lowkey important distinction, bestie πŸ’…


⭐ NOTES ⭐

  • glIndexub and glIndexubv are available only if the GL version is 1.1 or greater. so if you're on something older, sorry babe, they're not coming to the party 😭
  • the current index can be updated at any time. like, any time. in particular, glIndex can be called between a call to glBegin and the corresponding call to glEnd. yes, inside the begin/end sandwich. it's allowed. go off πŸŽ€

πŸ”₯ ASSOCIATED GETS πŸ”₯

you wanna read this value back? say less:

  • glGet with argument GL_CURRENT_INDEX

🌸 SEE ALSO 🌸

  • glColor(3G)
  • glIndexPointer(3G)

and that's the whole page, bestie β€” short, sweet, and fully committed to setting one single color index at a time 🫢

this was GLINDEX(3G) from the GLINDEX(3G) manual page β€” that's the source/version tag hanging out at the bottom, and yes, the title is the same as the footer because this page is nothing if not consistent πŸ’–

mwah, go set some indices, ily πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from