Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is the order of "glVertexAttribPointer" and "glEnableVertexAttribArray"? #7

Open
hutaocheng opened this issue Dec 21, 2016 · 1 comment

Comments

@hutaocheng
Copy link

hutaocheng commented Dec 21, 2016

In most case, the code is following the order "glVertexAttribPointer" first and then "glEnableVertexAttribArray". I think the interface "glVertexAttribPointer" is used to connect the buffer (managed by OpenGL) and the attrib (shader mananged by the pipeline), while the "glEnableVertexAttribArray" is used to submit the attachment to VAO then VAO can dispatch the buffer to related attribute, or vise vista.

But in Line 94 of "09-teapot.cpp"(and also the code for chapter 12 has the inverse order), the program is arranged in the inverse order
"void TeapotExample::Initialize(const char * title)
{
....
Line 94:
glEnableVertexAttribArray( vPosition );
glVertexAttribPointer( vPosition, 3, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
"
well, is the latter usage correct, or what happen when glEnableVertexAttribArray is called?

@jimmy12day
Copy link

I am waiting for the answer too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants