View Full Version : Multipass Rendering

05-17-2007, 10:23 PM
Dear OpenglProgrammers,

How to implement Multipass Rendering using Opengl and GLSL.

Any examples will be of great use.

Thanks in advance

05-17-2007, 11:37 PM
- enable depth test
- render depth (and optionally ambient color)
- enable additive blending
- disable depth test

for each light:
- render lighting

- disable additive blending

05-18-2007, 11:12 AM
Actually, you want to keep depth test enabled, and disable depth _writes_. It should be:

*enable depth test
*for each frame:
*set depth test to GL_LEQUAL or GL_LESS
*enable depth writes
*disable color writes (unless you want ambient)
*disable depth writes
*enable color writes
*set depth test to GL_EQUAL
*enable additive blending
*for each light:
*render lighting
*disable additive blending