Hi,

I’ve asked this question in the past, but re-visitng it again: given the lack 
of core support in Array for glVertexAttribDivisor, does anyone have any 
recommendations for getting per-instance data working easily?

I should state that I’m aware of the ‘use a texture and gl_InstanceID to sample 
it in the vertex shader' solution to this, but I need to pass somewhat more 
data than will fit into a standard texture for each instance (3 floats and 
various 8-bit values I could encode into a 32-bit int).

In the refactoring of osg::Geometry, the _DIVISOR_ arguments to Array binding 
were removed, since there was never any backend support, so the only option I 
am sure will work is a custom drawable, where I manually setup the arrays / 
VBOs, call glVertexAttribDivisor myself, and then call glDrawArraysInstanced 
myself. (I.e, bypass Array / PrimitiveSet / all the ArrayDispatcher machinery / 
Geometry:draw)

That feels like a rather excessive amount of work to solve this. Can anyone 
suggest anything simpler? I am aware that floating-point-textures might work to 
store my per-instance data needs, but I don’t have a good feeling for the 
portability of floating-point textures (on desktop hardware), whereas 
glVertexAttribDivisor is supported everywhere I care about. Similarly I’d be 
fine with making a hacked-up subclass of osg::Geometry which lets me bypass the 
ArrayDispatchers and invoke glVertexAttribDivisor myself, but I don’t know if 
that has a chance of working.

Kind regards,
James

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to