Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6622667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:26:12+00:00 2026-05-25T21:26:12+00:00

In OpenGL (OpenGL ES 2.0 in particular), is glVertexAttribPointer required to be called each

  • 0

In OpenGL (OpenGL ES 2.0 in particular), is glVertexAttribPointer required to be called each time a new VBO is bound?

For example:

glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer1);

glVertexAttribPointer(ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(vertexStruct), (void*)offsetof(vertexStruct,position));
glEnableVertexAttribArray(ATTRIB_POSITION);
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(vertexStruct), (void*)offsetof(vertexStruct,color);
glEnableVertexAttribArray(ATTRIB_COLOR);

glDrawElements(GL_TRIANGLE_STRIP, sizeof(indices)/sizeof(GLubyte), GL_UNSIGNED_BYTE, (void*)0);

// If vertexBuffer2 has the exact same attributes as vertexBuffer1
// is this legal or do the calls to glVertexAttribPointer (and glEnableVertexAttribArray)
// required again?

glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer2);
glDrawElements(GL_TRIANGLE_STRIP, sizeof(indices)/sizeof(GLubyte), GL_UNSIGNED_BYTE, (void*)0);

I know that there are VAOs that address not having to call glVertexAttribPointer but I’m wondering if this is ok to do in OpenGL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:26:12+00:00Added an answer on May 25, 2026 at 9:26 pm

    If you did this:

    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer1);
    
    glVertexAttribPointer(ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(vertexStruct), (void*)offsetof(vertexStruct,position));
    glEnableVertexAttribArray(ATTRIB_POSITION);
    glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(vertexStruct), (void*)offsetof(vertexStruct,color);
    glEnableVertexAttribArray(ATTRIB_COLOR);
    
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    
    glDrawElements(GL_TRIANGLE_STRIP, sizeof(indices)/sizeof(GLubyte), GL_UNSIGNED_BYTE, (void*)0);
    

    Your code would work just fine. What all of the gl*Pointer calls do is look at what is stored in GL_ARRAY_BUFFER at the time the function is called, and create an association between that buffer and that attribute. So the only way to change what buffer gets used for an attribute is to call gl*Pointer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to developing on iOS and in particular the new OpenGL related features on
I'm new to OpenGL. I have written a programm before getting to know OpenGL
I'm following this tutorial to learn something more about OpenGL and in particular point
Scenario: I am working on a Android project where in one particular openGL page,
I'm a bit confused about new OpenGL extensions, what hardware they require and what
I'm relatively new to OpenGL and have been using the GLTools library it provides.
Here's a good example: I'm trying to overload OpenGL's glutMouseFunc so it may accept
I am very new to OpenGL ES. I am implementing some demo app to
I am just starting out with OpenGL coding, and tried running an example that
I've never done OpenGL, but I'm looking for some pointers on this particular question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.