Hi Joseba,

Your mistake seems to be in your shaders. Let's examine:

// Vertex Shader
varying vec2 Texcoord;

void main( void )
{
    gl_FrontColor = gl_Color;
    gl_Position   = ftransform();
Texcoord = gl_MultiTexCoord0.xy; }

So here you're putting your texture coordinates into a varying called Texcoord (that should be gl_TextureMatrix[0] * gl_MultiTexCoord0 by the way).

// Fragment shader
uniform sampler2D baseMap;
varying vec2 Texcoord;

void main( void )
{
    gl_FragColor = vec4(texture2D( baseMap,gl_TexCoord[0].st).xyz, 0.0);
}

Here you don't use your Texcoord varying, but instead use gl_TexCoord[0] which has not been set by the vertex shader. That's probably why you're getting a bad result, you're using an undefined variable.

Instead, you could forget using an varying and just do this in the vertex shader:

  gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

And leave your fragment shader as it is.

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to