Sign in to follow this  
Aliii

Changing offset in VBO after object instances

Recommended Posts

Aliii    1456

I want to draw the same object many times, but with different colors. In one VBO I have the vertex positions, in an other VBO I have the colors. (So if I want to draw 10 instances from the object, the color-VBO has 10 times as many elements as the first VBO.)

 

So I would need to change the offset in the color-VBO after every instance. Is it possible without vertexAttribPointer? ....or any expensive state change? Thanks!

Share this post


Link to post
Share on other sites
DrEvil    1148

glColorPointer takes a pointer, or with VBOs, treats it as an offset to start from, so you could vary that to the offset of the color you want.

Share this post


Link to post
Share on other sites
Aliii    1456

glColorPointer is deprecated, and is an expensive state change.

Im looking for something like instanced rendering but sort of the opposite.

Edited by Aliii

Share this post


Link to post
Share on other sites
mhagain    13430

Are you quite sure that issuing a glVertexAttribPointer call is an "expensive state change" (as you say)?  Have you actually profiled this and determined that this is a bottleneck for you, or are you pre-emptively optimizing?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this