Texture Buffers for hardware instanced geometry

After making that post, I thought to myself: Gee, adding support for buffer textures wouldn’t really be difficult at all, and it would certainly make it easier (and possibly faster) to pass huge amounts of data to a shader.

So, I did, and it’s checked into Git. Windows development builds containing these changes are now available here.

To use it, there’s a new way to set up a texture, using setupBufferTexture. You need to make sure that your component type and your format match up or you’ll end up reinterpreting data. It also takes an additional usage hint parameter, which indicates how often you’ll be updating the buffer data. This has the same meaning as it does for GeomPrimitive and GeomVertexData.

I’ve attached a sample program that shows how to use it.
EDIT: mistake in the sample, replace “NUM_INST * 16” with “NUM_INST”
buffer-textures.zip (1.59 KB)