GLGETACTIVEATTRIB(3G)
π GLGETACTIVEATTRIB (3G) β like, the whole manual, bestie
okay so before we even start: this is the 3G manual page (yes the header has a little [FIXME: manual] placeholder in it, we love a work in progress π). it's about glGetActiveAttrib, and it's genuinely so useful once it clicks. buckle up. π
β¨ NAME β¨
glGetActiveAttrib β returns info about an active attribute variable for the program object you point at. that's it, that's the vibe. π¦
πΈ C SPECIFICATION πΈ
void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize,
GLsizei *length, GLint *size, GLenum *type,
GLchar *name);
she's long, she's iconic, copy her exactly. π
π«Ά PARAMETERS π«Ά
programβ the program object you're interrogating. like "hey bestie tell me about yourself".indexβ which attribute variable you want. the index of the attribute variable to be queried, specifically.bufSizeβ the max number of characters OpenGL is allowed to write into the character buffer thatnamepoints to. no overflowing, we're classy. β¨lengthβ returns the number of characters OpenGL actually wrote into the string atname(null terminator not included) β but only if you pass it something other thanNULL.sizeβ returns the size of the attribute variable.typeβ returns the data type of the attribute variable.nameβ returns a null terminated string holding the attribute variable's name.
π DESCRIPTION π
so glGetActiveAttrib gives you the tea on an active attribute variable inside the program object you named in program. wanna know how many active attributes there even are? call glGetProgram() with GL_ACTIVE_ATTRIBUTES. π§
index of 0 picks the first active attribute variable. permissible values for index are from zero up to (number of active attribute variables minus one). math girlie hours. π
a vertex shader can use built-in attribute variables, user-defined attribute variables, or both:
- built-in ones have the prefix
"gl_"and reference conventional OpenGL vertex attributes (likegl_Vertex,gl_Normal, etc. β the OpenGL Shading Language spec has the complete list, iykyk). - user-defined ones have arbitrary names and get their values through numbered generic vertex attributes.
an attribute variable (built-in or user-defined, doesn't matter) counts as active if, during the link operation, it's determined that it may be accessed during program execution. so program should already have been the target of a glLinkProgram() call β but lowkey it does not need to have linked successfully. π
need to know how big a buffer to allocate for the longest attribute variable name in program? call glGetProgram() with GL_ACTIVE_ATTRIBUTE_MAX_LENGTH. use that value to allocate a buffer big enough for the returned attribute name, pass the buffer's size in bufSize, and pass a pointer to it in name. main character buffer energy. π
glGetActiveAttrib returns the name of the attribute variable indicated by index, storing it in the character buffer specified by name. the string it returns will be null terminated. the actual number of characters written into the buffer comes back in length, and that count does not include the null termination character. don't care about the length? pass NULL in the length argument and move on. π
type is a pointer to a variable where the attribute variable's data type gets written. these symbolic constants may be returned:
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4, GL_FLOAT_MAT2,
GL_FLOAT_MAT3, GL_FLOAT_MAT4, GL_FLOAT_MAT2x3, GL_FLOAT_MAT2x4,
GL_FLOAT_MAT3x2, GL_FLOAT_MAT3x4, GL_FLOAT_MAT4x2, GL_FLOAT_MAT4x3,
GL_INT, GL_INT_VEC2, GL_INT_VEC3, GL_INT_VEC4, GL_UNSIGNED_INT,
GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4,
GL_DOUBLE, GL_DOUBLE_VEC2, GL_DOUBLE_VEC3, GL_DOUBLE_VEC4,
GL_DOUBLE_MAT2, GL_DOUBLE_MAT3, GL_DOUBLE_MAT4, GL_DOUBLE_MAT2x3,
GL_DOUBLE_MAT2x4, GL_DOUBLE_MAT3x2, GL_DOUBLE_MAT3x4, GL_DOUBLE_MAT4x2,
GL_DOUBLE_MAT4x3
and size returns the size of the attribute, in units of whatever type came back in type. slay. π₯
the list of active attribute variables can include both built-in attribute variables (the "gl_" prefix girlies) and user-defined attribute variable names. everyone's invited. π
this function returns as much info as it can about the specified active attribute variable. if no info is available, length will be 0 and name will be an empty string. when does that happen? could occur if you call this function after a link operation that failed. and if an error occurs at all, the return values length, size, type, and name will be left unmodified. π«Ά
π ERRORS π
GL_INVALID_VALUEis generated ifprogramis not a value generated by OpenGL.GL_INVALID_OPERATIONis generated ifprogramis not a program object.GL_INVALID_VALUEis generated ifindexis greater than or equal to the number of active attribute variables inprogram.GL_INVALID_VALUEis generated ifbufSizeis less than0.
not the GL_INVALID_VALUE jumpscare π read your args before you call, bestie.
β ASSOCIATED GETS β
glGet()with argumentGL_MAX_VERTEX_ATTRIBS.glGetProgram()with argumentGL_ACTIVE_ATTRIBUTESorGL_ACTIVE_ATTRIBUTE_MAX_LENGTH.glIsProgram()
π VERSION SUPPORT π
glGetActiveAttrib is supported in every one of these OpenGL versions, no skips, no gaps, all checks:
2.0β2.1β3.0β3.1β3.2β3.3β4.0β4.1β4.2β4.3β4.4β4.5β
all twelve. she ate and left no crumbs. πβ¨
π¦ SEE ALSO π¦
glBindAttribLocation(), glLinkProgram(), glVertexAttrib(), glVertexAttribPointer()
π COPYRIGHT π
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group
and that's the whole page, periodt π β sourced from [FIXME: source], dated 08/09/2021, filed under GLGETACTIVEATTRIB(3G). go query some attributes, you've got this πΈπ«Άπ₯
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms