0
$\begingroup$

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;
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &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?

$\endgroup$

1 Answer 1

2
$\begingroup$

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.

$\endgroup$

Your Answer

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

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