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/
