Jump to content

  • Log In with Google      Sign In   
  • Create Account


Changing offset in VBO after object instances


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Aliii   Members   -  Reputation: 1344

Like
0Likes
Like

Posted 29 October 2013 - 03:14 AM

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!



Sponsor:

#2 DrEvil   Members   -  Reputation: 1079

Like
0Likes
Like

Posted 29 October 2013 - 07:04 AM

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.



#3 Aliii   Members   -  Reputation: 1344

Like
0Likes
Like

Posted 29 October 2013 - 10:08 AM

glColorPointer is deprecated, and is an expensive state change.

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


Edited by Aliii, 29 October 2013 - 10:29 AM.


#4 mhagain   Crossbones+   -  Reputation: 7467

Like
1Likes
Like

Posted 29 October 2013 - 11:20 AM

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?


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#5 3TATUK2   Members   -  Reputation: 721

Like
0Likes
Like

Posted 29 October 2013 - 08:30 PM

VAO






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS