Projective texture mapping problem

Hi, I’m trying to do shadows with projective texture mapping, but I can’t get the projective texture map transformation matrix right. Can anyone recommend a good tutorial that explains each OpenGL call and doesn’t go into matrix multiplication??

Thanx in advance,


Fleejay

Have a look at the projtex.c sample here: http://www.sgi.com/software/opengl/advanced97/programs/programs.html . It’s pretty concise.

   -Jason

I’ve seen this code before and I still don’t really understand how the transformations work.

I’ve got something working but I seem to have many different shadows being cast as if their are many different textures being projected or one texture being tiled.

The pseudocode I am using is:

//lookat object from light view
glLoadIdentity();
glulookat( model );
glMatrixMode( GL_MODELVIEW );

drawobject();

glGetFloatv( GL_MODELVIEW_MATRIX, textureXform );

glCopyTexImage2D( … );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS);
// and for t, r and q

glEnable(GL_TEXTURE_GEN_S);
// and for t, r and q

glMatrixMode( GL_TEXTURE );
glLoadIdentity();
glTranslatef( 0.5, 0.5, 0.0 );
glScalef( 0.5, 0.5, 1.0 );
gluPerspective( 40.0, 1.0, 0.1, 1.0 );
inverse( textureXform, inv );
glMultMatrixf( inv );
glMatrixMode( GL_MODELVIEW );

Then I transform to the new camera view and redraw the scene enabling texturing etc.

Any help would be greatly appreciated.

Fleejay