Quark
12-04-2010, 02:46 AM
In my project I'm using the texture-matrix like this:
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(...);
glTranslatef(...);
gluPerspective(...);
glTranslatef(...);
gluLookAt(...);
The strange thing is, that with this code everything worked perfectly as long as I didn't use a shaderprogram:
VS:
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
FS:
uniform sampler2D TextureSampler0;
void main(void)
{
gl_FragColor = texture2D (TextureSampler0,
vec2(gl_TexCoord[0]));
}
The shaderprogram is quite simple and I think i handled the texturematrix correctly...
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
after some try i found out that as long as I don't use gluPerspective(...), I get the same result using the shaderprogram as without the shaderprogram:
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(...);
glTranslatef(...);
//gluPerspective(...); <- here is the problem .
glTranslatef(...);
gluLookAt(...);
I've no idea why my code doesn't work. I also tryed it on another computer...
I hope you can find the mistake I made...
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(...);
glTranslatef(...);
gluPerspective(...);
glTranslatef(...);
gluLookAt(...);
The strange thing is, that with this code everything worked perfectly as long as I didn't use a shaderprogram:
VS:
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
FS:
uniform sampler2D TextureSampler0;
void main(void)
{
gl_FragColor = texture2D (TextureSampler0,
vec2(gl_TexCoord[0]));
}
The shaderprogram is quite simple and I think i handled the texturematrix correctly...
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
after some try i found out that as long as I don't use gluPerspective(...), I get the same result using the shaderprogram as without the shaderprogram:
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(...);
glTranslatef(...);
//gluPerspective(...); <- here is the problem .
glTranslatef(...);
gluLookAt(...);
I've no idea why my code doesn't work. I also tryed it on another computer...
I hope you can find the mistake I made...