Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly does glEnableVertexAttribArray do?

Tags:

opengl

I have been reading:

http://alfonse.bitbucket.io/oldtut/Basics/Tut01%20Dissecting%20Display.html

I am not quite sure what this function does.
I think it enables the use of a given VBO, but I am not sure.

I thought that is what glEnableClientState(GL_VERTEX_ARRAY) did.

like image 961
LunchMarble Avatar asked Aug 09 '11 17:08

LunchMarble


People also ask

What is glEnableVertexAttribArray?

Description. glEnableVertexAttribArray enables the generic vertex attribute array specified by index . glDisableVertexAttribArray disables the generic vertex attribute array specified by index . By default, all client-side capabilities are disabled, including all generic vertex attribute arrays.

What does VAO store?

A Vertex Array Object (VAO) is an OpenGL Object that stores all of the state needed to supply vertex data (with one minor exception noted below). It stores the format of the vertex data as well as the Buffer Objects (see below) providing the vertex data arrays.

What does a vertex array object do?

A Vertex Array Object (or VAO) is an object that describes how the vertex attributes are stored in a Vertex Buffer Object (or VBO). This means that the VAO is not the actual object storing the vertex data, but the descriptor of the vertex data.

What is OpenGL vertex shader?

The Vertex Shader is the programmable Shader stage in the rendering pipeline that handles the processing of individual vertices. Vertex shaders are fed Vertex Attribute data, as specified from a vertex array object by a drawing command.


1 Answers

I have been reading: https://nicolbolas.github.io/oldtut/Basics/Tut01%20Dissecting%20Display.html

Then please read the next page; I explain exactly what it does there ;)

If I may quote myself:

We assigned the attribute index of the position attribute to 0 in the vertex shader, so the call to glEnableVertexAttribArray(0) enables the attribute index for the position attribute. ... If the attribute is not enabled, it will not be used during rendering.

like image 85
Nicol Bolas Avatar answered Sep 27 '22 21:09

Nicol Bolas