If I have two different primitive types which are drawn dynamically according to user input, should I use 2 separate VBOs or is there a way of using one and of somehow identifying where the different primitive vertices begin and end?
The primitive types are triangle strips and points
Either method works. If using a VBO the
dataparameter of thegl…Pointerfunctions is interpreted as a numeric byte offset into the VBO. It’s perfectly possible to put seveal batches of vertex attributes into a single VBO and point OpenGL to the sections within the VBO by their offsets.So before each
glDraw…call use the rightgl…Pointercalls to set the right offsets. Or even better yet (if supported, i.e. you’ve got a new enough OpenGL version): Use Vertex Array Objects to encapsulate whole set ofgl…Pointersettings into one abstract object that can be bound by a single OpenGL call.