Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * TODO STEP 31: Set glColorMask and glDepthMask to false. Enable the
- * stencil test.
- */
- gl.glColorMask(false, false, false, false);
- gl.glDepthMask(false);
- gl.glEnable(GL10.GL_STENCIL_TEST);
- /*
- * TODO STEP 32a: Set the stencil function to always pass. Use 1 as
- * reference value. Set bitmask to ~0.
- */
- gl.glStencilFunc(GL10.GL_ALWAYS, 1, 0);
- /*
- * TODO STEP 32b: Set the stencil operation to GL_REPLACE to replace the
- * current value in the stencil buffer. As the stencil test always
- * passes the value for stencil fail does not matter.
- */
- gl.glStencilOp(GL10.GL_REPLACE, GL10.GL_REPLACE, GL10.GL_INCR);
- /*
- * TODO STEP 13b: Draw the floor and execute the application!
- */
- mFloor.draw(gl);
- /*
- * TODO STEP 33: Set glColorMask and glDepthMask to true and draw the
- * floor a second time. As the stencil function has been inserted, the
- * first call causes the floor to be drawn into the stencil buffer but
- * not on the display anymore.
- */
- gl.glColorMask(true, true, true, true);
- gl.glDepthMask(true);
- mFloor.draw(gl);
- /*
- * TODO STEP 34a: Change the stencil function to be true when the value
- * in the stencil buffer equals 1 (GL_EQUAL 1). Set the bitmask to ~0
- * again.
- */
- gl.glStencilFunc(GL10.GL_EQUAL, 1, 0);
- /*
- * TODO STEP 34b: Change the stencil function to always keep (GL_KEEP)
- * the stencil buffer value in order to get overlaying shadows. If you
- * want to have physically correct shadows use GL_INCR for the z-pass
- * value. However, you won't see the nice cube shadow anymore as the
- * ceiling is taken into account.
- */
- gl.glStencilFunc(GL10.GL_KEEP, 1, 0);
- gl.glStencilOp(GL10.GL_REPLACE, GL10.GL_DECR, GL10.GL_INCR);
- gl.glPushMatrix();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement