Hi Terry,

I believe uniform array support in OpenGL is still in its early
stages, constant indices seem ok, but not elements that have
variables.  Mike Weiblen wrote some shaders a while back to test the
array support which revealled this problem, and I've seen references
to similar problems on opengl.org forums too.

However, I haven't seen any crashes, but then I haven't tested the
array support too much in anger.  I believe osgCharacter has uniform
array usage, so perhaps this could be used as a test platform too.

Robert.

On 7/23/06, Terry Welsh <[EMAIL PROTECTED]> wrote:
Hi,
 This is probably an OpenGL driver bug, but maybe I'm just setting something
up wrong.  Has anyone else tried to use an array of samplers in a GLSL
shader?  I'm setting up my array of samplers like this:

     shadowmapUniform = new
Uniform(Uniform::SAMPLER_2D_SHADOW, "shadowmap",
NUM_SHADOW_MAPS);
     for(i=0; i<NUM_SHADOW_MAPS; i++){

sceneSS->setTextureAttributeAndModes(i+FIRST_SHADOW_TEX_UNIT,
shadowmap[i].get(), StateAttribute::ON);
         shadowmapUniform->setElement(i, i+FIRST_SHADOW_TEX_UNIT);
     }
     sceneSS->addUniform(shadowmapUniform.get());

 The fragment shaders defines the samplers like this:

     uniform sampler2DShadow shadowmap[4];

 And it accesses one of them like this:

     float shadow = shadow2D(shadowmap[0], lsPosition).r;

 And then I get a segmentation fault.  If I don't call the shadow2D function
in the shader, everything keeps running and I just don't get any shadows.
Has anyone else had any luck doing anything like this before, or does this
look like a driver bug?  I'm using an NVidia 6800GT on Linux with the 8762
driver.
--
Terry Welsh - mogumbo 'at' gmail.com
www.reallyslick.com  |   www.mogumbo.com
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


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

Reply via email to