Changing offset in VBO after object instances

Started by
3 comments, last by 3TATUK2 10 years, 5 months ago

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!

Advertisement

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.

glColorPointer is deprecated, and is an expensive state change.

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

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?

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

VAO

This topic is closed to new replies.

Advertisement