0
votes

I'm trying to use mipmapping to get a downsampled version of a texture of type GL_DEPTH_COMPONENT. I enable mipmaps similar to this:

glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

And use it in the shader like this:

texture2D(reference_view, coord, 5.0).bgr;

With 5.0 being the mipmap level I want to access.

This works fine for rgba textures, however I can't seem to get it work with the depth component texture. Is it even supported in opengl?

2

2 Answers

0
votes

I managed to do it after all! Was some problem with the order of binding textures.

So the answer is: YES!

-1
votes

No, OpenGL does not support mipmapping of GL_DEPTH_COMPONENT. But that shouldn't be the real problem.

It is a good idea to reconsider the reason you want to mipmap GL_DEPTH_COMPONENT. In practice, this shouldn't ever be a good idea. In situations where linear interpolation of depth values is required, a better way to achieve this is through a fragment shader.