Saturday, July 30, 2016

glEnableVertexAttribArray

Official


Name

glEnableVertexAttribArray
  enable or disable a generic vertex attribute array.


C Specification

void glEnableVertexAttribArray(
  GLuint index
);

  index \specifies the index of the generic vertex attribute to be enabled or disabled.


Description

glEnableVertexAttribArray and glEnableVertexArrayAttrib enable the generic vertex attribute array specified by indexglEnableVertexAttribArray uses currently bound vertex array object for the operation, whereas glEnableVertexArrayAttrib updates state of the vertex array object with ID vaobj.
glDisableVertexAttribArray and glDisableVertexArrayAttrib disable the generic vertex attribute array specified by indexglDisableVertexAttribArray uses currently bound vertex array object for the operation, whereas glDisableVertexArrayAttrib updates state of the vertex array object with ID vaobj.
By default, all client-side capabilities are disabled, including all generic vertex attribute arrays. If enabled, the values in the generic vertex attribute array will be accessed and used for rendering when calls are made to vertex array commands such as glDrawArraysglDrawElementsglDrawRangeElementsglMultiDrawElements, or glMultiDrawArrays.

SO How it is like :-)

'glEnableVertexAttribArray(0) enables the attribute index for the position attribute' - doesn't explain anything. Why we need to enable it and when? We call glVertexAttribPointer - to indicate where ogl should take vertices or other data for shader input, why then we need to call this additional function? Should i call this method every time active shader program changed, if vertex shader? 
It's similar to a vertex array but stores additional extra values for each point rather than it's coordinates. You might want to store a temperature, density, signal strength at each point in a modelling app for example, or perhaps a damage value for a game




No comments:

Post a Comment