I have an application that uses only the default opengl framebuffer. It is initialized with color and depth buffer. I want to use the depth buffer as a uniform within a shader to access the current depth values. How can I make this happen? I tried to get the GLint ID of the depth buffer with the following command:

GLint params;
std::cout << "Depthbuffer id:" << params << std::endl;

the output is something like 325462352776. so that doesn't work :(

How can I get the correct ID of the depth buffer so I can use it to read its values in a shader?


1 Answer 1


Components of the default framebuffer do not have an "ID". You can only use those images as components of the default framebuffer.

If you want to use images in a framebuffer as textures or the like, then you're going to have to create them yourself. You cannot rely on the default framebuffer's images.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.