PDA

View Full Version : dual-parabploid environment mapping problem



Slang
09-25-2004, 02:32 AM
Hi there,

right now I'm trying to implement the dual-parabploid environment mapping [1, 2] by the the fixed-function pipelines.
I'm using the following code to do the 2-pass method (alpha test) but somehow it doesn't work well...

The problem which I have is this:
http://xslgl.jugem.cc/?image=5644


glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5);

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glLoadMatrixf(A);
glMultMatrixf(P);
glMultMatrixf(Sfront);
glMultMatrixf(Mlinv);

glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, g_Texture[PRBLD_FACE]);

glMatrixMode(GL_MODELVIEW);
glColor3f(1.0, 1.0, 1.0);
glutSolidTeapot(1.0);

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glLoadMatrixf(A);
glMultMatrixf(P);
glMultMatrixf(Sback);
glMultMatrixf(Mlinv);

glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, g_Texture[PRBLD_BACK]);

glMatrixMode(GL_MODELVIEW);
glColor3f(1.0, 1.0, 1.0);
glutSolidTeapot(1.0);I think the matrices, A, P, Sfront, Sback and Mlinv (invert matrix of the modelview) is correct.
So I guess the cause of the problem is the paraboloid maps,
but the problem is that I don't know what the problem is... :(

Give me a hint, please?
Thanks.

References
[1] http://www.nada.kth.se/~gustavt/dpm/
[2] http://www.opengl.org/resources/tutorials/sig99/advanced99/notes/node184.html