My OpenGL clipping plane doesn't work--can anyone tell me what I am doing wrong? here is my code:
The idea is to draw a hovering ball above a floor, and, using the stencil buffer, draw a reflection of the ball. draw_object() draws the ball. It's supposed to clip to keep the reflection on the floor like an accurate reflection wouldCode:double eqr[] = {0.0f, -1.0f, 0.0f, 0.0f}; // clip plane equation glLoadIdentity(); // reset the view glTranslatef(0.0f, -0.6f, zoom); // move down a bit and back by the value in zoom . . . glEnable(GL_CLIP_PLANE0); // enable clipping glClipPlane(GL_CLIP_PLANE0, eqr); // tell opengl where we want to clip glPushMatrix(); // push the matrix glScalef(1.0f, -1.0f, 1.0f); // mirror everthing (it's supposed to be a reflection, after all) glLightfv(GL_LIGHT0, GL_POSITION, light_pos); // set up light 0 glTranslatef(0.0f, height, 0.0f); // move to where we want to draw the ball (opposite, because it's mirrored) glRotatef(xrot, 1.0f, 0.0f, 0.0f); // rotate on the x axis glRotatef(yrot, 0.0f, 1.0f, 0.0f); // rotate on the y axis draw_object(); // now draw the ball glPopMatrix(); // pop the matrix glDisable(GL_CLIP_PLANE0); // disable clipping glDisable(GL_STENCIL_TEST); // turn off the stencil buffer. Everthing works, except the clipping. (I'm not sure if my picture attachment will come through or not)



LinkBack URL
About LinkBacks
. Everthing works, except the clipping. (I'm not sure if my picture attachment will come through or not) 


