in the ofFbo documenation it is said:
As an example of an advanced usage: Create an ofFbo. Attach the color buffer of the ofFbo to a texture. Attach the depth buffer of the ofFbo to a texture. Render the texture to screen with a pixel shader using ofShader.
and thats exactly what i want to do, but I dont know how. is there a way to create a ofTexture for the depthbuffer?
I’ve tried a lot to access, bind or draw the depthbuffer before i found this in the current develop brach:
bool depthAsTexture; // use a texture instead of a renderbuffer for depth (useful to draw it or use it in a shader later)
sounds perfect! i tried to bind the texture and draw it in the way which works for the color texture, but still no luck.
ofTextureData texData = fbo.getTextureReference().getTextureData(); glActiveTexture(GL_TEXTURE0); glEnable(texData.textureTarget); //glBindTexture( texData.textureTarget, (GLuint)texData.textureID ); glBindTexture( texData.textureTarget, fbo.getDepthBuffer()); ...
in both cases - binding getDepthBuffer (=1) or texData.texureId (=2) - the quad is drawn with the color texture.
do you have any suggestions? whats the right way to do this?