Hello Yann,
Yann Mazel wrote:
> I'm encountering a strange behaviour trying to link 2 different
> textureChunks to a fragment shader. I'm using OpenSG 1.8
> I want to access 2 different textures in my fragment shader to do some
> depth related blending. But when I access my uniform sampler2DRects in the
> shader I get the same texture in both samplers. Nevertheless I checked the
> 2 TexChunk->getGLId() indexes and they have different values...
> I also assume I'm in a non-standard OpenSG behaviour AFAI'm on server code
> (I retrieve the client-side declared shaderChunkPtr via the
> the()->getFieldContainerStore() technique, many thanks Dirk). Do you think
> my problem is related to this ?
this sounds more like you are not assigning any values to your
sampler2DRects. A GLSL sampler variable is essentially a special type of
uniform int. The value of that int can not be set in shader code it must
come from the application and is the texture unit you want that sampler
to read from when doing texture lookups.
So if you have:
sampler2DRect sourceImgA;
sampler2DRect sourceImgB;
you need to do:
SHLChunkPtr shl;
shl->setUniformParameter("sourceImgA", 0);
shl->setUniformParameter("sourceImgB", 1);
or replace 0 and 1 with the correct texture unit your textures are in.
If you just add two TextureChunks to a Material they will be in 0 and 1,
to have more control over this you can pass a slot number when adding
the chunks.
Cheers,
Carsten
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users