   Bad reflections
  I'm having some problems with reflections that were ... kind of working properly before. At least, I wasn't having the problem that I have now.Here's the code for it:/** * Render a flat reflective surface * \param refl The ReflectionData object that contains the data for the reflection */void CVideoDriver::renderFlatReflection(const ReflectionData& refl){// copy the clipping plane for use with OGL functionsdouble plane[4] = {refl.clippingPlane.m_normal.x, refl.clippingPlane.m_normal.y, refl.clippingPlane.m_normal.z,refl.clippingPlane.m_distance };// disable drawing for all colorsglColorMask(0, 0, 0, 0);// enable the stencil testing for the objectglEnable(GL_STENCIL_TEST);// set the stencil buffer so the test always passes, has a 1-bit plane, 1 as mask// Keep if the test fails, keep if the test passes but the buffer test fails// Replace if test passesglStencilFunc(GL_ALWAYS, 1, 1);glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);// disable depth testingglDisable(GL_DEPTH_TEST);glPushMatrix();// render the reflective surface into the stencil buffersrefl.reflectiveObject->render();glPopMatrix();// So, now we want to draw the scene, but only want the pixels to show up where the stencil buffer// has the value of 1 (where the reflective surface was drawn)/////// Draw the reflection ///////glEnable(GL_DEPTH_TEST);// enable depth testingglColorMask(1, 1, 1, 1);// enable drawing for all colorsglStencilFunc(GL_EQUAL, 1, 1);// we draw only where the stencil is 1 (where the reflective surface was drawn)glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);// don't change the stencil bufferglEnable(GL_CLIP_PLANE0);// enable the clipping plane glClipPlane(GL_CLIP_PLANE0, plane);// equation for reflected objectsglPushMatrix();// mirror the Y axisglScalef(1.0f, -1.0f, 1.0f);// draw the things to be reflected (everything except the object that contains the reflection)//m_sceneManager->renderAllBut(refl.reflectiveObject);m_sceneManager->render();glPopMatrix();glDisable(GL_CLIP_PLANE0);// disable the clip plane for drawing the reflective surfaceglDisable(GL_STENCIL_TEST);// disable stencil testingglEnable(GL_BLEND);// enable the blending so the scene being reflected will showglDisable(GL_LIGHTING);// disable the lighting because we're using blending// set the color to white with 80% alphaglColor4f(1.0f, 1.0f, 1.0f, 0.8f);// set the blending for the objectglBlendFunc(GL_SRC_COLOR, GL_ONE);glPushMatrix();// draw the object that contains the reflectionrefl.reflectiveObject->render();glPopMatrix();// re-enable the lighting and disable the blendingglEnable(GL_LIGHTING);glDisable(GL_BLEND);}I'm currently in the process of writing a proper material system, so that's the reason why I've created this function to draw the reflective surfaces. I know that I've got the call to glScale incorrect for the general case, but at the moment, I'm just trying to make it work for this first case properly before changing it.I'm not really sure what the problem is. I mean, it looks like soome of the cube is being obscured by the floor. Is this something to do with the clipping plane? Because, for the scene in the picture, it is set to {0.0, -1.0, 0.0, 0.0}.Oh, and, just under the call to glScale, I'm rendering the whole scene again. The problem is that the object that is the reflective surface is part of the scene. Should I be rendering the whole scene except for the reflective surface at that point? Or should I be rendering that as well?   
  I think you have face culling enabled, and since a reflection reverses the vertex winding order, the front faces are getting culled when rendering the reflection. To correct, just try reversing the winding (glFrontFace) when you are doing the reflection.   