Hi,
From what Robert said, I'm still guessing this is an OpenGL driver problem.  To answer your questions:  I tried converting the code and shaders to make this a GL_RGBA texture instead of a GL_DEPTH_COMPONENT texture.  The texture2D function had the same problem with an array of sampler2Ds.  I haven't tried your temporary scalar sampler idea yet, but I'll do it when I get home tonight (I don't have the code here).  Thanks.....

I should also mention that GLSL has no trouble with the array of mat4s that I use to transform my vertices into light space.  So nice job on the uniform array code.
- Terry

Message: 38
Date: Mon, 24 Jul 2006 00:49:21 -0700
From: Mike Weiblen <[EMAIL PROTECTED]>
Subject: Re: [osg-users] array of samplers
To: osg users < [email protected]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

Hi Terry,

I haven't tried this myself, but it wouldn't surprise me if implementations were
a bit shakey.

Do other texture lookup functions beside shadow2D() work (or at least not
crash)?  Or perhaps assign the specific sampler array element to a temporary
scalar sampler variable, etc.

Cheers
-- mew


Terry Welsh 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 <http://gmail.com>
> www.reallyslick.com <http://www.reallyslick.com>  |   www.mogumbo.com
> <http://www.mogumbo.com >
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to