Save QOpenGLFrameBufferObject depth attachment texture as an image
Unsolved
General and Desktop
-
Hi, I am using a QOpenGLFrameBuffer object to calculate a shadow map so, I only need the depth attachment to make a texture with depth values. I want to check that the texture that it is creating is right so I need to get it and save it.
I tried to do fbo.toImage().save but the image is empty and I think that it is saving the color attachment texture which is correctly empty.
¿How can I save the depth attachment texture? I think that when I do fbo.texture() is returning the id of the texture at my depth attachment as I have defined it as the target, but it only returns the id of the texture to use it, fiest i want to check that I am creating correctly it.Here is how I created the QOpenGLFrameBuffer:
shadowFBO = new QOpenGLFramebufferObject(shadowMapWidth,shadowMapHeight,QOpenGLFramebufferObject::Depth,GL_TEXTURE_2D,GL_RGBA); bool res = shadowFBO->bind();
Thanks