Implementing reflectivity what am i doing wrong?
I am following nehe''s tutorial on reflectivity trying to get the ball in my game to reflect off of the floor. I have tried to get it to work but no luck so far. Here are a few discrepancies from what happens in nehe''s tutorial and mine. In mine there is no reflection on the floor and the ball is actually drawn on both sides of the floor. At first I thought that the first draw ball wasn''t going to stenciling but I checked the code and it should be. Here is the code:
glColorMask(0,0,0,0);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glDisable(GL_DEPTH_TEST);
DrawFloor(g_Texture);
glEnable(GL_DEPTH_TEST);
glColorMask(1,1,1,1);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glEnable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE0, eqr);
glPushMatrix();
glScalef(1.0f, -1.0f, 1.0f);
glLightfv(GL_LIGHT0, GL_POSITION, LightPos1);
glLightfv(GL_LIGHT1, GL_POSITION, LightPos2);
glLightfv(GL_LIGHT2, GL_POSITION, LightPos3);
glLightfv(GL_LIGHT3, GL_POSITION, LightPos4);
glLightfv(GL_LIGHT4, GL_POSITION, LightPos5);
ball.DrawBall(.45,g_Texture);
glPopMatrix();
glDisable(GL_CLIP_PLANE0);
glDisable(GL_STENCIL_TEST);
glLightfv(GL_LIGHT0, GL_POSITION, LightPos1);
glLightfv(GL_LIGHT1, GL_POSITION, LightPos2);
glLightfv(GL_LIGHT2, GL_POSITION, LightPos3);
glLightfv(GL_LIGHT3, GL_POSITION, LightPos4);
glLightfv(GL_LIGHT4, GL_POSITION, LightPos5);
glEnable(GL_BLEND);
glDisable(GL_LIGHTING);
glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawFloor(g_Texture);
glEnable(GL_LIGHTING);
glDisable(GL_BLEND);
DrawStadium(g_Texture);
ball.DrawBall(.45,g_Texture);
player.Update(framerate);
if (ball.GetAttached()==false)
{
ball.Update(framerate,juststarted);
}
I looked at it over and over and I can''t find really anything different than the lesson what am i doing wrong?
"understanding is a three-edged sword: your side, their side.. and the truth"
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
I know its a little bit of code to look at but can someone help me I''m stumped.
"understanding is a three-edged sword: your side, their side.. and the truth"
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
I went back through it for a few more hours and its like even though I enabled the stencil test so that the first time you draw the ball on the other side of the floor it for some reason draws it real. Why would this be?
"understanding is a three-edged sword: your side, their side.. and the truth"
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
"The degree of technical competence is inversely proportional to the level of management."
"Any given program, when running, is obsolete."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement