# glGetAttribLocation

Definition: | include pGUI.e include opengl.e integer res = glGetAttribLocation(integer program, string name)
Description: | return the location of an attribute variable program: Specifies the program object to be queried. name: the name of the attribute variable whose location is to be queried.
pwa/p2js: | Supported.
Notes: | glGetAttribLocation queries the previously linked program object specified by program for the attribute variable specified by name and returns the index of the generic vertex attribute that is bound to that attribute variable. If name is a matrix attribute variable, the index of the first column of the matrix is returned. If the named attribute variable is not an active attribute in the specified program object or if name starts with the reserved prefix "gl_", a value of -1 is returned. The association between an attribute variable name and a generic attribute index can be specified at any time by calling glBindAttribLocation(). Attribute bindings do not go into effect until glLinkProgram() is called. After a program object has been linked successfully, the index values for attribute variables remain fixed until the next link command occurs. The attribute values can only be queried after a link if the link was successful. glGetAttribLocation returns the binding that actually went into effect the last time glLinkProgram() was called for the specified program object. Attribute bindings that have been specified since the last link operation are not returned by glGetAttribLocation. Technically shader compiler support is optional, however opengl.e and pwa/p2js simply assume it is always available. If an error is generated the specified default is returned, but checking that glGetError() does not return GL_NO_ERROR should normally be used to verify that an error did actually occur, unless the specified default is unequivocably invalid.
Errors: | GL_INVALID_OPERATION is generated if program is not a value generated by OpenGL. GL_INVALID_OPERATION is generated if program is not a program object. GL_INVALID_OPERATION is generated if program has not been successfully linked.
Associated Gets: | glGetActiveAttrib with argument program and the index of an active attribute glIsProgram
See Also: | glBindAttribLocation, glLinkProgram, Y, glVertexAttribPointer DEV See Also //glBindAttribLocation, //glLinkProgram, glVertexAttrib, //glVertexAttribPointer