I am trying to generate mipmaps, which are based on depthbuffer values. To generate the next mipmap level, I am trying to read in the 4 pixels of the upper mipmap level per pixel. Unlike the usual mipmap generation. I am checking the depth values, and only averaging those of the 4 pixels which are in depth range. To do so, I need to read in the next larger mipmap level than the current one I am suppose to render to. I know, that reading from the same texture than rendering to is not allowed. but I found this post on stackoverflow: https://stackoverflow.com/questions/44349792/is-it-possible-to-render-to-textures-mipmap-level-1-while-sampling-from-level-0 Here in the comments one person is talking about "texture mipmap range specifiers". Does that mean, that I don't need to use two framebuffers (one for reading and one for writing and for each mipmap level switching between these both framebuffers?) with two textures to do what I am trying? If so. How can I specify which mipmap should be read from the shader? I am using
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, mipmaplevelToRenderTo);
command to render into a specific mipmap level. And I only want to read pixels from level "mipmaplevelToRenderTo - 1"