PDA

View Full Version : Geometry instancing and vertex streams


Puzzler183
2005.04.16, 08:33 PM
In DirectX, to facilitate geometry instancing, you can use what they called vertex streams (rather than dynamic or static batching). Sounds good, and it's pretty well documented in GPU Gems 2. But, when I looked at the ATI vertex stream extension for OpenGL, it didn't seem to be the same thing. Similiar but the OpenGL extension guide claims it's to go with the vertex weighting extensions. So can it be used for the same purpose or is there some other extension I have to use?

And if it can, does anyone have sample code by chance since it was kind of unclear to me from the book.

phydeaux
2005.04.17, 02:34 AM
The vertex stream concept has been around longer than hardware instancing, and GL_ATI_vertex_streams is fairly old, but doesn't support instancing. "Instancing" is just taking the vertex stream concept and allowing you to treat a stream repeated more than once as a single stream (instead of having to re-issue the same data) - For example, you have the N vertex positions for an object, but then you want a bunch (say, K of them) of instances of the object with different colors- you'd setup a huge array with all the instances striped together of size N*K, and then you can issue a single call where all the instance data is used, and the vertex positions are repeated K times.

Is this available in OpenGL? This question was actually recently asked at GDC and the answer was that you can already get about the same performance in OpenGL using VBOs and immediate mode. In the above example, if you have the vertex positions and all the instance data loaded, you can simply move a pointer around to change the beginning of the instance data (move it ahead N places each time) to draw each instance.

You can take a look here at a discussion about the GDC presentation: http://www.gamedev.net/columns/events/coverage/feature.asp?feature_id=75

Puzzler183
2005.04.17, 03:00 AM
Well, that's pretty irritating... Hopefully that will be rectified soon...

I guess I just won't be supporting it in my engine (so I can maintain the multiple API thing).