Difference between revisions of "GLAPI/glGetVertexAttrib"

From OpenGL Wiki
Jump to navigation Jump to search
m (Bot: Adjusting API page category.)
m (Bot: Adding better formatting.)
 
(4 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
== Function Definition ==
 
== Function Definition ==
  
   void '''glGetVertexAttribdv'''(GLuint ''index'', GLenum ''pname'', GLdouble *''params'');
+
   void '''glGetVertexAttribdv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLdouble *{{param|params}});
   void '''glGetVertexAttribfv'''(GLuint ''index'', GLenum ''pname'', GLfloat *''params'');
+
   void '''glGetVertexAttribfv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLfloat *{{param|params}});
   void '''glGetVertexAttribiv'''(GLuint ''index'', GLenum ''pname'', GLint *''params'');
+
   void '''glGetVertexAttribiv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLint *{{param|params}});
   void '''glGetVertexAttribIiv'''(GLuint ''index'', GLenum ''pname'', GLint *''params'');
+
   void '''glGetVertexAttribIiv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLint *{{param|params}});
   void '''glGetVertexAttribIuiv'''(GLuint ''index'', GLenum ''pname'', GLuint *''params'');
+
   void '''glGetVertexAttribIuiv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLuint *{{param|params}});
   void '''glGetVertexAttribLdv'''(GLuint ''index'', GLenum ''pname'', GLdouble *''params'');
+
   void '''glGetVertexAttribLdv'''(GLuint {{param|index}}, GLenum {{param|pname}}, GLdouble *{{param|params}});
  
 
; index
 
; index
 
: Specifies the generic vertex attribute parameter to be queried.
 
: Specifies the generic vertex attribute parameter to be queried.
 
; pname
 
; pname
: Specifies the symbolic name of the vertex attribute parameter to be queried. Accepted values are {{code|GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING}}, {{code|GL_VERTEX_ATTRIB_ARRAY_ENABLED}}, {{code|GL_VERTEX_ATTRIB_ARRAY_SIZE}}, {{code|GL_VERTEX_ATTRIB_ARRAY_STRIDE}}, {{code|GL_VERTEX_ATTRIB_ARRAY_TYPE}}, {{code|GL_VERTEX_ATTRIB_ARRAY_NORMALIZED}}, {{code|GL_VERTEX_ATTRIB_ARRAY_INTEGER}}, {{code|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}}, or {{code|GL_CURRENT_VERTEX_ATTRIB}}.
+
: Specifies the symbolic name of the vertex attribute parameter to be queried. Accepted values are {{enum|GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_ENABLED}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_SIZE}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_STRIDE}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_TYPE}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_NORMALIZED}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_INTEGER}}, {{enum|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}}, or {{enum|GL_CURRENT_VERTEX_ATTRIB}}.
 
; params
 
; params
 
: Returns the requested data.
 
: Returns the requested data.
Line 24: Line 24:
 
== Description ==
 
== Description ==
  
'''glGetVertexAttrib''' returns in ''params'' the value of a generic vertex attribute parameter. The generic vertex attribute to be queried is specified by ''index'', and the parameter to be queried is specified by ''pname''.
+
'''glGetVertexAttrib''' returns in {{param|params}} the value of a generic vertex attribute parameter. The generic vertex attribute to be queried is specified by {{param|index}}, and the parameter to be queried is specified by {{param|pname}}.
  
 
The accepted parameter names are as follows:
 
The accepted parameter names are as follows:
  
; {{code|GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING}}
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING}}
:  
+
: {{param|params}} returns a single value, the name of the buffer object currently bound to the binding point corresponding to generic vertex attribute array {{param|index}}. If no buffer object is bound, 0 is returned. The initial value is 0.
''params'' returns a single value, the name of the buffer object currently bound to the binding point corresponding to generic vertex attribute array ''index''. If no buffer object is bound, 0 is returned. The initial value is 0.
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_ENABLED}}
; {{code|GL_VERTEX_ATTRIB_ARRAY_ENABLED}}
+
: {{param|params}} returns a single value that is non-zero (true) if the vertex attribute array for {{param|index}} is enabled and 0 (false) if it is disabled. The initial value is {{enum|GL_FALSE}}.
:  
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_SIZE}}
''params'' returns a single value that is non-zero (true) if the vertex attribute array for ''index'' is enabled and 0 (false) if it is disabled. The initial value is {{code|GL_FALSE}}.
+
: {{param|params}} returns a single value, the size of the vertex attribute array for {{param|index}}. The size is the number of values for each element of the vertex attribute array, and it will be 1, 2, 3, or 4. The initial value is 4.
; {{code|GL_VERTEX_ATTRIB_ARRAY_SIZE}}
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_STRIDE}}
:  
+
: {{param|params}} returns a single value, the array stride for (number of bytes between successive elements in) the vertex attribute array for {{param|index}}. A value of 0 indicates that the array elements are stored sequentially in memory. The initial value is 0.
''params'' returns a single value, the size of the vertex attribute array for ''index''. The size is the number of values for each element of the vertex attribute array, and it will be 1, 2, 3, or 4. The initial value is 4.
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_TYPE}}
; {{code|GL_VERTEX_ATTRIB_ARRAY_STRIDE}}
+
: {{param|params}} returns a single value, a symbolic constant indicating the array type for the vertex attribute array for {{param|index}}. Possible values are {{enum|GL_BYTE}}, {{enum|GL_UNSIGNED_BYTE}}, {{enum|GL_SHORT}}, {{enum|GL_UNSIGNED_SHORT}}, {{enum|GL_INT}}, {{enum|GL_UNSIGNED_INT}}, {{enum|GL_FLOAT}}, and {{enum|GL_DOUBLE}}. The initial value is {{enum|GL_FLOAT}}.
:  
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_NORMALIZED}}
''params'' returns a single value, the array stride for (number of bytes between successive elements in) the vertex attribute array for ''index''. A value of 0 indicates that the array elements are stored sequentially in memory. The initial value is 0.
+
: {{param|params}} returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by {{param|index}} are normalized when they are converted to floating point, and 0 (false) otherwise. The initial value is {{enum|GL_FALSE}}.
; {{code|GL_VERTEX_ATTRIB_ARRAY_TYPE}}
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_INTEGER}}
:  
+
: {{param|params}} returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by {{param|index}} have integer data types, and 0 (false) otherwise. The initial value is 0 ({{enum|GL_FALSE}}).
''params'' returns a single value, a symbolic constant indicating the array type for the vertex attribute array for ''index''. Possible values are {{code|GL_BYTE}}, {{code|GL_UNSIGNED_BYTE}}, {{code|GL_SHORT}}, {{code|GL_UNSIGNED_SHORT}}, {{code|GL_INT}}, {{code|GL_UNSIGNED_INT}}, {{code|GL_FLOAT}}, and {{code|GL_DOUBLE}}. The initial value is {{code|GL_FLOAT}}.
+
; {{enum|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}}
; {{code|GL_VERTEX_ATTRIB_ARRAY_NORMALIZED}}
+
: {{param|params}} returns a single value that is the frequency divisor used for instanced rendering. See {{apifunc|glVertexAttribDivisor}}. The initial value is 0.
:  
+
; {{enum|GL_CURRENT_VERTEX_ATTRIB}}
''params'' returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by ''index'' are normalized when they are converted to floating point, and 0 (false) otherwise. The initial value is {{code|GL_FALSE}}.
+
: {{param|params}} returns four values that represent the current value for the generic vertex attribute specified by index. Generic vertex attribute 0 is unique in that it has no current state, so an error will be generated if {{param|index}} is 0. The initial value for all other generic vertex attributes is (0,0,0,1).
; {{code|GL_VERTEX_ATTRIB_ARRAY_INTEGER}}
+
 
:  
 
''params'' returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by ''index'' have integer data types, and 0 (false) otherwise. The initial value is 0 ({{code|GL_FALSE}}).
 
; {{code|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}}
 
:  
 
''params'' returns a single value that is the frequency divisor used for instanced rendering. See [[GLAPI/glVertexAttribDivisor|glVertexAttribDivisor]]. The initial value is 0.
 
; {{code|GL_CURRENT_VERTEX_ATTRIB}}
 
:  
 
''params'' returns four values that represent the current value for the generic vertex attribute specified by index. Generic vertex attribute 0 is unique in that it has no current state, so an error will be generated if ''index'' is 0. The initial value for all other generic vertex attributes is (0,0,0,1).
 
 
'''glGetVertexAttribdv''' and '''glGetVertexAttribfv''' return the current attribute values as four single-precision floating-point values; '''glGetVertexAttribiv''' reads them as floating-point values and converts them to four integer values; '''glGetVertexAttribIiv''' and '''glGetVertexAttribIuiv''' read and return them as signed or unsigned integer values, respectively; '''glGetVertexAttribLdv''' reads and returns them as four double-precision floating-point values.
 
'''glGetVertexAttribdv''' and '''glGetVertexAttribfv''' return the current attribute values as four single-precision floating-point values; '''glGetVertexAttribiv''' reads them as floating-point values and converts them to four integer values; '''glGetVertexAttribIiv''' and '''glGetVertexAttribIuiv''' read and return them as signed or unsigned integer values, respectively; '''glGetVertexAttribLdv''' reads and returns them as four double-precision floating-point values.
All of the parameters except {{code|GL_CURRENT_VERTEX_ATTRIB}} represent state stored in the currently bound vertex array object.
+
 
 +
All of the parameters except {{enum|GL_CURRENT_VERTEX_ATTRIB}} represent state stored in the currently bound vertex array object.
  
 
== Notes ==
 
== Notes ==
  
If an error is generated, no change is made to the contents of ''params''.
+
If an error is generated, no change is made to the contents of {{param|params}}.
  
 
== Errors ==
 
== Errors ==
  
{{code|GL_INVALID_OPERATION}} is generated if ''pname'' is not {{code|GL_CURRENT_VERTEX_ATTRIB}} and there is no currently bound vertex array object.
+
{{enum|GL_INVALID_OPERATION}} is generated if {{param|pname}} is not {{enum|GL_CURRENT_VERTEX_ATTRIB}} and there is no currently bound vertex array object.
  
{{code|GL_INVALID_VALUE}} is generated if ''index'' is greater than or equal to {{code|GL_MAX_VERTEX_ATTRIBS}}.
+
{{enum|GL_INVALID_VALUE}} is generated if {{param|index}} is greater than or equal to {{enum|GL_MAX_VERTEX_ATTRIBS}}.
  
{{code|GL_INVALID_ENUM}} is generated if ''pname'' is not an accepted value.
+
{{enum|GL_INVALID_ENUM}} is generated if {{param|pname}} is not an accepted value.
  
{{code|GL_INVALID_OPERATION}} is generated if ''index'' is 0 and ''pname'' is {{code|GL_CURRENT_VERTEX_ATTRIB}}.
+
{{enum|GL_INVALID_OPERATION}} is generated if {{param|index}} is 0 and {{param|pname}} is {{enum|GL_CURRENT_VERTEX_ATTRIB}}.
  
 
== Associated Gets ==
 
== Associated Gets ==
  
[[GLAPI/glGet|glGet]] with argument {{code|GL_MAX_VERTEX_ATTRIBS}}
+
{{apifunc|glGet}} with argument {{enum|GL_MAX_VERTEX_ATTRIBS}}
  
[[GLAPI/glGetVertexAttribPointerv|glGetVertexAttribPointerv]] with arguments ''index'' and {{code|GL_VERTEX_ATTRIB_ARRAY_POINTER}}
+
{{apifunc|glGetVertexAttribPointerv}} with arguments {{param|index}} and {{enum|GL_VERTEX_ATTRIB_ARRAY_POINTER}}
  
 
== See Also ==
 
== See Also ==
  
[[GLAPI/glBindAttribLocation|glBindAttribLocation]], [[GLAPI/glBindBuffer|glBindBuffer]], [[GLAPI/glDisableVertexAttribArray|glDisableVertexAttribArray]], [[GLAPI/glEnableVertexAttribArray|glEnableVertexAttribArray]], [[GLAPI/glVertexAttrib|glVertexAttrib]], [[GLAPI/glVertexAttribDivisor|glVertexAttribDivisor]], [[GLAPI/glVertexAttribPointer|glVertexAttribPointer]]
+
{{apifunc|glBindVertexArray}}, {{apifunc|glEnableVertexAttribArray}}, {{apifunc|glVertexAttrib}}, {{apifunc|glVertexAttribDivisor}}, {{apifunc|glVertexAttribPointer}}, {{apifunc|glVertexAttribFormat}}
  
 
== Copyright ==
 
== Copyright ==
Line 86: Line 79:
 
Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010 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/ http://opencontent.org/openpub/].
 
Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010 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/ http://opencontent.org/openpub/].
  
[[Category:API Reference 4|GetVertexAttrib]]
+
[[Category:Core API Ref Vertex Specification|GetVertexAttrib]]
[[Category:GL 4 API Vertex Specification|GetVertexAttrib]]
+
[[Category:Core API Reference|GetVertexAttrib]]

Latest revision as of 01:50, 27 September 2012

glGetVertexAttrib
Core in version 4.6
Core since version 2.0

glGetVertexAttrib: Return a generic vertex attribute parameter

Function Definition

 void glGetVertexAttribdv(GLuint index​, GLenum pname​, GLdouble *params​);
 void glGetVertexAttribfv(GLuint index​, GLenum pname​, GLfloat *params​);
 void glGetVertexAttribiv(GLuint index​, GLenum pname​, GLint *params​);
 void glGetVertexAttribIiv(GLuint index​, GLenum pname​, GLint *params​);
 void glGetVertexAttribIuiv(GLuint index​, GLenum pname​, GLuint *params​);
 void glGetVertexAttribLdv(GLuint index​, GLenum pname​, GLdouble *params​);
index
Specifies the generic vertex attribute parameter to be queried.
pname
Specifies the symbolic name of the vertex attribute parameter to be queried. Accepted values are GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_VERTEX_ATTRIB_ARRAY_SIZE, GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_VERTEX_ATTRIB_ARRAY_TYPE, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, or GL_CURRENT_VERTEX_ATTRIB.
params
Returns the requested data.

Description

glGetVertexAttrib returns in params​ the value of a generic vertex attribute parameter. The generic vertex attribute to be queried is specified by index​, and the parameter to be queried is specified by pname​.

The accepted parameter names are as follows:

GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
params​ returns a single value, the name of the buffer object currently bound to the binding point corresponding to generic vertex attribute array index​. If no buffer object is bound, 0 is returned. The initial value is 0.
GL_VERTEX_ATTRIB_ARRAY_ENABLED
params​ returns a single value that is non-zero (true) if the vertex attribute array for index​ is enabled and 0 (false) if it is disabled. The initial value is GL_FALSE.
GL_VERTEX_ATTRIB_ARRAY_SIZE
params​ returns a single value, the size of the vertex attribute array for index​. The size is the number of values for each element of the vertex attribute array, and it will be 1, 2, 3, or 4. The initial value is 4.
GL_VERTEX_ATTRIB_ARRAY_STRIDE
params​ returns a single value, the array stride for (number of bytes between successive elements in) the vertex attribute array for index​. A value of 0 indicates that the array elements are stored sequentially in memory. The initial value is 0.
GL_VERTEX_ATTRIB_ARRAY_TYPE
params​ returns a single value, a symbolic constant indicating the array type for the vertex attribute array for index​. Possible values are GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, and GL_DOUBLE. The initial value is GL_FLOAT.
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
params​ returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by index​ are normalized when they are converted to floating point, and 0 (false) otherwise. The initial value is GL_FALSE.
GL_VERTEX_ATTRIB_ARRAY_INTEGER
params​ returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by index​ have integer data types, and 0 (false) otherwise. The initial value is 0 (GL_FALSE).
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
params​ returns a single value that is the frequency divisor used for instanced rendering. See glVertexAttribDivisor. The initial value is 0.
GL_CURRENT_VERTEX_ATTRIB
params​ returns four values that represent the current value for the generic vertex attribute specified by index. Generic vertex attribute 0 is unique in that it has no current state, so an error will be generated if index​ is 0. The initial value for all other generic vertex attributes is (0,0,0,1).

glGetVertexAttribdv and glGetVertexAttribfv return the current attribute values as four single-precision floating-point values; glGetVertexAttribiv reads them as floating-point values and converts them to four integer values; glGetVertexAttribIiv and glGetVertexAttribIuiv read and return them as signed or unsigned integer values, respectively; glGetVertexAttribLdv reads and returns them as four double-precision floating-point values.

All of the parameters except GL_CURRENT_VERTEX_ATTRIB represent state stored in the currently bound vertex array object.

Notes

If an error is generated, no change is made to the contents of params​.

Errors

GL_INVALID_OPERATION is generated if pname​ is not GL_CURRENT_VERTEX_ATTRIB and there is no currently bound vertex array object.

GL_INVALID_VALUE is generated if index​ is greater than or equal to GL_MAX_VERTEX_ATTRIBS.

GL_INVALID_ENUM is generated if pname​ is not an accepted value.

GL_INVALID_OPERATION is generated if index​ is 0 and pname​ is GL_CURRENT_VERTEX_ATTRIB.

Associated Gets

glGet with argument GL_MAX_VERTEX_ATTRIBS

glGetVertexAttribPointerv with arguments index​ and GL_VERTEX_ATTRIB_ARRAY_POINTER

See Also

glBindVertexArray, glEnableVertexAttribArray, glVertexAttrib, glVertexAttribDivisor, glVertexAttribPointer, glVertexAttribFormat

Copyright

Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010 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/.