-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GL_TEXTURE_2D_ARRAY layer as ImGui::Image #3198
Comments
Linking to #2489 |
Hello @ocornut Context is simple - I'm writing editor for my ES 3.0 engine and I decided to store textures in texture array atlases to reduce texture switching as much as possible. So I need a handy widget to visualize what's going on inside of my atlases #2489 looks interesting, but I'm unsure if it canl help (need to go deeper into details). Theoretically third coordinate stands for layer number, but idk if it will be possible to look at mips for each layer too (if present) |
Author of 2489 says that it is possible to render layers of texture arrays though, gotta test it in ES 3.0 mode |
OK, this pull request sounds good. We can move discussion |
If all you need is to render them occasionally, it feels it may be easier to pass in callbacks with info for your renderer to switch shaders and pass in a shader than would take the extra coordinates from uniforms instead of vertices (edited) |
Is there any examples or code snippets which I can refer to? I don't quite know how to achieve this. Thanks a lot! |
@hls333555 I didn't test it myself, but you can try to pass glTextureView. Like you can treat specific layer of GL_TEXTURE_2D_ARRAY as GL_TEXTURE_2D |
Thanks for NukeBird's advice! For anybody who wants to achieve this, here's the sample code: // Be sure to call the following after originTexture being created and initialized properly
glGenTextures(arraySize, textureViews);
for (int32_t i = 0; i < arraySize; ++i)
{
glTextureView(textureViews[i], GL_TEXTURE_2D, originTexture, format, 0, 1, i, 1);
}
// Then you can use textureViews[index] as usual Texture ID More details: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTextureView.xhtml. |
@hls333555 do you have any full code examples? I can't seem to get glTextureView to work. |
Is it possible to show specific layer of GL_TEXTURE_2D_ARRAY using ImGui::Image?
If no, is here any alternatives?
The text was updated successfully, but these errors were encountered: