Mazy

04-07-2004, 02:45 AM

Am i doing something wrong here?

Im just trying to project a texture

(vertex shader)

varying vec4 tex;

uniform mat4 ModelViewInv;

void main () {

gl_Position = ftransform();

tex = (gl_Vertex*ModelViewInv*gl_TextureMatrix[0]);

}

(fragment shader)

uniform sampler2D tx;

varying vec4 tex;

void main () {

gl_FragColor = texture2DProj(tx,tex);

}

ModelViewInv is the inverse of the modelview matrix ( at the point of drawing)

and the texture matrix is

glLoadIdentity();

glTranslatef(0.5,0.5,0.5);

glScalef(0.5,0.5,0.5);

gluPerspective(FOV,1,zNear,zFar);

LightPos.ApplyInv; ( multiply with inverse matrox of the light)

i dont get any usefull result.

Im just trying to project a texture

(vertex shader)

varying vec4 tex;

uniform mat4 ModelViewInv;

void main () {

gl_Position = ftransform();

tex = (gl_Vertex*ModelViewInv*gl_TextureMatrix[0]);

}

(fragment shader)

uniform sampler2D tx;

varying vec4 tex;

void main () {

gl_FragColor = texture2DProj(tx,tex);

}

ModelViewInv is the inverse of the modelview matrix ( at the point of drawing)

and the texture matrix is

glLoadIdentity();

glTranslatef(0.5,0.5,0.5);

glScalef(0.5,0.5,0.5);

gluPerspective(FOV,1,zNear,zFar);

LightPos.ApplyInv; ( multiply with inverse matrox of the light)

i dont get any usefull result.