Planar Reflections § Stencil can help to maintain the floor § Clear stencil to zero. § Draw floor polygon with stencil set to one. § Then, only draw reflection where stencil is one. § Finally, deactivate stencil and draw the rest of the scene.
One Last Thing void display(void) { glEnable(GL_CULL_FACE); // checks all the faces that are front facing towards // the viewer and renders those while discarding all // the faces that are back facing // Improve performance also! glDisable(GL_CULL_FACE); }
Test Yourselves § Test 1. Add reflections to your game. For instance, add a mirror or a table with a reflective surface § Test 2. Add a menu that allows enable/disable reflections