Projection texture messed up

Hello everyone.,

I’m giving my first steps in the world of shaders, and i’m having a little problem., i hope someone can give me some light.

I’m tryng to do a shader, to distort a water reflection.
The water reflection is already in a texture, and it’s being projected correctly to the water plane.,

But, somehow when i have automatic coordinates generation enabled in opengl, and i go trough the shader, the shader messes up my coords.
This is the shader :

The vertex program :

varying vec3  texCoord; 

void main(void) 
    texCoord    =; 
    gl_Position = ftransform(); 

and the fragment program

uniform sampler2D Texture0; 

varying vec3 texCoord; 

void main(void) 
    gl_FragColor = texture2DProj( Texture0, texCoord ); 

I just want the reflected texture to show up, with anything changed, so i can start messing with it later.

thanks for any help,

The TexGen operations are disabled when you run vertex shaders, so you have two choices: not use vertex shaders (and use gl_TexCoord[0] in the fragment shader) or make your own computations to generate the texcoord. I didn’t tested the first way but should work.

Many thanks Ffelagund :slight_smile: , got it working

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.