PDA

View Full Version : Reflection using frame buffer



rakeshmalik91
07-01-2013, 10:22 AM
water reflection just using scaling glScalef(1, 1, -1) is being blocked by terrain under water.
So i think it would be better if reflection is first stored in framebuffer.
but how can i project the rendered texture on the water

marcClintDion
07-01-2013, 01:00 PM
If you wanted to do things the first way that you tried you might temporarily disable depth testing. If the reflection is drawn after the terrain that was hiding it, it should now still be visible. You could also try glScalef(1, 1, -0.7), instead, this might keep the reflection above the underwater terrain as well.

If you want to render to an FBO, then you'd draw the reflection to an FBO. Once that's done, the FBO texture should behave like any other texture. Apply it to the water as a texture just like you normally would.