[osg-users] Problem with shaders

Guy Lifchitz prometheus.the.great at gmail.com
Mon Jul 23 06:22:53 PDT 2007


  Hi,
 I have some code in the fragment program that acts really suspiciously it
goes like this:
at the end it suppose to be
for(int iTexture = 0; iTexture < unf_nTextures; ++iTexture)
{
    Color += sampler2D(iTexture, gl_TexCoord[iTexture].st);
}

for debugging purpose I wrote
 for(int iTexture = 0; iTexture < unf_nTextures; ++iTexture)
{
    Color = sampler2D(iTexture, gl_TexCoord[iTexture].st);
}

now I checked by setting the Color in different code that unf_nTextures is
1.
the code above results with Color = 0.0,0.0,0.0,?
on the other hand
 for(int iTexture = 0; iTexture < unf_nTextures; ++iTexture)
{
    Color = sampler2D(0, gl_TexCoord[0].st);
}

results correctly (when there is only one texture of course).

another strange phenomenon is that the code
 for(int iTexture = 0; iTexture < unf_nTextures; ++iTexture)
{
    if(iTexture == 0)
        Color = sampler2D(0, gl_TexCoord[iTexture].st);
}
also results with Color = 0.0,0.0,0.0,?

any ideas?

thanks,
 Guy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070723/3e0b05a2/attachment.html 


More information about the osg-users mailing list