Hi guys. Im trying to get a blending step working with shadows and lighting in two seperate passes. I figure blending two textures together would be the way to go about it, so I’ve render the phong step and shadow step into two seperate ofxFbo objects.
The problem is, neither is doing proper depth testing. glEnable(GL_DEPTH_TEST) is set everytime the geometry function is called but it appears to have no effect at all:
mColourFBO.begin(); glClearColor(0.0, 0.0, 0.0, 1.0); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(55,ofGetWidth()/ ofGetHeight(),0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(gCameraPos.x,gCameraPos.y,gCameraPos.z,gCameraTarget.x,gCameraTarget.y,gCameraTarget.z,0,1,0); drawGeometry(); mColourFBO.end();
I notice that a depth buffer is automagically attached by default to an FBO when it is created. The thing is, calling drawGeometry outside of the FBO gives the correct result so something else must need to happen to get depth testing.