PDA

View Full Version : glDrawElementsInstanced and textures



Trydea
05-03-2010, 09:45 AM
Hi,

I was thinking about using "glDrawElementsInstanced" in order to render multiple objects. The well known idea is to create a texture containing information about position of each instance (accessing it with gl_InstanceID). But I could not figure out how it was possible to use different textures for each instance... actually, it is maybe NOT possible, is it ?
The last idea I had was to use a 3D texture created using all the 2D textures for my instances. But, is it possible to create 3D textures that are not multiple of 2 : for example, is it possible to create a 3D texture of size 1024x1024x5 ?

Thank you,
Tom

AlexN
05-03-2010, 10:19 AM
Yes, you can create a 3D texture of size 1024x1024x5. But, what you are probably looking for are 2D texture arrays.

http://www.opengl.org/registry/specs/EXT/texture_array.txt

Trydea
05-03-2010, 10:57 AM
Exactly what I needed ! Thanks !