[osg-users] Problem with shaders

Guy Lifchitz prometheus.the.great at gmail.com
Mon Jul 23 11:20:45 PDT 2007


I ment texture2D, this is not the point here. The point is the weird
behaviour I mentioned before.
thanks,
 Guy.


On 7/23/07, Robert Osfield <robert.osfield at gmail.com> wrote:
>
> Hi Guy,
>
> To read a texture in GLSL you using texture2D rather than sampler2D,
> is sampler2D a function you've provided?
>
> Robert.
>
> On 7/23/07, Guy Lifchitz <prometheus.the.great at gmail.com> wrote:
> >
> > 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.
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070723/d89ea01b/attachment.html 


More information about the osg-users mailing list