You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a texture in depth format and attached it to the camera. As I wanted to create an HIZ (Hierarchical Depth), I set the texture's MIN_FILTER to LINEAR_MIPMAP_LINEAR and used the setNumMipmapLevels() function to set the desired number of mipmaps. However, when I used NSight to view the results, I found that this texture generated all the mipmap levels it could generate, But when I created another color texture with the same settings, I found that it could generate the correct number of mipmap levels
This confuses me. I followed the code of OSG and found that the problem may be in the selectSizedInternalFormat function of Texture.cpp, which seems to check the InternalFormat of the texture through an array called sizedInternalFormats, but this array only contains color format. The depth and template format are in another array called sizedDepthAndStencilInternalFormats, In fact, there is also an array called compressedInternalFormats, and selectSizedInternalFormat ignores the other two arrays, resulting in the function being unable to return the correct value for depth formats;
This resulted in the value of texStorageSizedInternalFormat being 0, making it impossible to use glTexStorage2D to create textures, instead using glTexImage2D. In this case, to control the mipmap level, I can only use glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level). However, after browsing the code, I found that only one place called this function and it requires the texture to have Image, so my depth texture cannot set the mipmap level, When it generates mipmap, it will generate all mipmap levels
The above are all my conjectures;
The text was updated successfully, but these errors were encountered:
I created a texture in depth format and attached it to the camera. As I wanted to create an HIZ (Hierarchical Depth), I set the texture's MIN_FILTER to LINEAR_MIPMAP_LINEAR and used the setNumMipmapLevels() function to set the desired number of mipmaps. However, when I used NSight to view the results, I found that this texture generated all the mipmap levels it could generate, But when I created another color texture with the same settings, I found that it could generate the correct number of mipmap levels
This confuses me. I followed the code of OSG and found that the problem may be in the selectSizedInternalFormat function of Texture.cpp, which seems to check the InternalFormat of the texture through an array called sizedInternalFormats, but this array only contains color format. The depth and template format are in another array called sizedDepthAndStencilInternalFormats, In fact, there is also an array called compressedInternalFormats, and selectSizedInternalFormat ignores the other two arrays, resulting in the function being unable to return the correct value for depth formats;
Taking Texture2D.cpp as an example:
This resulted in the value of texStorageSizedInternalFormat being 0, making it impossible to use glTexStorage2D to create textures, instead using glTexImage2D. In this case, to control the mipmap level, I can only use glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level). However, after browsing the code, I found that only one place called this function and it requires the texture to have Image, so my depth texture cannot set the mipmap level, When it generates mipmap, it will generate all mipmap levels
The above are all my conjectures;
The text was updated successfully, but these errors were encountered: