PDA

View Full Version : GLSL tex coord problem



maximal
09-30-2005, 05:52 PM
Hi I'm having trouble getting my texture coordinates mapped over the whole mesh

I have tiled texture coords and full texture coords : I believe the problem is
in my shader.

Relevant sections:

init in loop:

TexCoords[i].u = x ;
TexCoords[i].v = z ;

TexCoords2[i].u = x/MAP_SIZE;
TexCoords2[i].v = z/MAP_SIZE;

......


in ARB setup

.......

glClientActiveTextureARB(GL_TEXTURE3_ARB); //MIX
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, TexCoords2);

glActiveTextureARB(GL_TEXTURE3_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mixcolmap);
glUniform1iARB(mixloc,3);

in vert shader
.......

gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;

gl_Position = ftransform();

in .frag shader
......


vec2 src3 = vec2(gl_TexCoord[0].st);
vec3 T3 = texture2D(tex2, src3).xyz;

vec2 src4 = vec2(gl_TexCoord[1].st);
vec3 amount = texture2D(tex3, src4).xyz;

I'm getting both tex coordinaltes tiled , when gl_TexCoord[1] should map over
the whole surface.
I've tried different approaches:

vec3 T3 = texture2D(tex2, gl_TexCoord[0]).xyz; etc

but no luck. Does anyone know what is going on ?

Regards

sqrt[-1]
10-01-2005, 06:45 AM
You sure you are enabling the texture coordinates 0 and 1 with the proper data?

You only show setting up texture stage 3 with coordinates,

glClientActiveTextureARB(GL_TEXTURE3_ARB); //MIX
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, TexCoords2);

how are stages 0 and 1 setup? (or is the above a typo or the bug)