Hello,
I'm looking for hints on how to implement the equivalent of "arrays of structs" in GLSL and OSG. Currently I have three struct uniforms defined in a fragment shader loaded via OpenSceneGraph.

   struct AStruct
   {
int id; vec2 center; }; uniform AStruct obj1;
   uniform AStruct obj2;
   uniform AStruct obj3;

I would like to support N (=3 in above example) being quite large (say 10 or 20) without creating N (mostly unused) uniforms, by using an array of size N. But GLSL does not seem to support this, and doesn't support casting either (e.g. so I could pack in the info in a 2D texture and map it to an array of structs).

Any ideas or URL's where I could find how to go about this would be much appreciated.

Oliver

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to