-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
ImGui::Image renders a font atlas instead of a multi-sampled texture #3591
Comments
Hello, You can see how the render loop is setup in Normally we use draw callback for manipulating the render state from outside but here specifically since that
|
Hey, thank you for your response. I tried your suggestion, but I would like to try the third option, use |
You can use native OpenGL methods for submitting a simple vertex buffer, but you can use the ImDrawVert type and use the existing ImGui shader if it works for you |
I have tried so much by now regarding
But this is aside of the This is what my callback currently looks like (it's a static member function and works just as good as a non-member friend function):
What I do regarding updating the vertex buffer whenever I resize my ImGui viewport window:
And here is how I add the callback (with complete context):
What happens in |
I found out that it is my responsibility to restore the state of the last vertex array/buffer bindings at the end of my callback. That resolved the Now however, what my callback renders to the screen can only be seen when I move the ImGui viewport window at certain positions such that the upper left corner of it is outside of my OpenGL main window: For an explanation: at first you see my viewport use I can't simply use Another off topic question: Is it possible to make the menu background in the viewport transparent? I tried pushing different style colors with different alpha values but no luck so far. Ideally I would like to try make it fully transparent and be on top of my viewport image. |
Any update regarding a possible solution or at least a confirmation that it is a bug? |
Well its a bug but since all the rendering is in your hands at this point it is a bug in your code. Have you tried using a graphics debugger such as Renderdoc to debug your issue and find what’s causing the image to disappear? Once you solve it, if you can suggest a solution we could implement on the backend side I am happy to hear it. |
Hi! |
@sebastianzander I have simply used blit buffers for resolving GL_TEXTURE_2D_MULTISAMPLE into GL_TEXTURE_2D state. However, as I understand, it won't fit all your needs. Other solution I still don't have, it needs more investigation. |
Pushed some changes e94f95d (+ f890d85) to formalize giving access to more data from callbacks (see #6969 (comment)) so I wonder if some of this may be easier to solve if we expose data from the OpenGL render function? I was also working on a more general/wider version of #2697 to allow differentiating "internal textures" (created/managed by backend) from user texture. But a simpler version in the form of a single callback like in #2697 may facilitate this. @sebastianzander I don't presume you still have this code in place and running? (it's been a while) |
You may in theory also submit another callback using Basically if you still have this code running and around, I would be happy to see the code and further discuss simpler solutions. |
Hi @ocornut, no sorry I don't have it running anymore. It was initially a hobbyist project and turned out to even help me with my thesis back in 2020, but I haven't done any OpenGL stuff since. In the meantime I got a new computer, so I don't have any OpenGL stuff installed, and I don't think that I will find spare time to get it running again. |
Version/Branch of Dear ImGui:
Version: v1.80 WIP
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp (OpenGL 4.6 on a NVIDIA GeForce RTX 2060)
Compiler: Microsoft Visual Studio Enterprise 2017 (15.9)
Operating System: Windows 10
My Issue:
I render to a framebuffer in order to have multiple scene view windows of my 3D scene and in order to render the color or the depth buffer for reasons of debugging and research. It worked well without multi-sampled textures but I want to get rid of aliasing. That's why I switched my normal GL_TEXTURE_2D implementation to GL_TEXTURE_2D_MULTISAMPLE. I check the framebuffer status, OpenGL says everything is fine with it.
When I use ImGui::Image as before (no changes here) I see a font atlas (presumably from ImGui) instead of my framebuffer (color or depth attachment).
Screenshots
Standalone, minimal, complete and verifiable example:
As stated earlier, I only replaced
GL_TEXTURE_2D
withGL_TEXTURE_2D_MULTISAMPLE
,glTexImage2D
withglTexImage2DMultisample
andglTexStorage2D
withglTexStorage2DMultisample
(the arguments changed of course)The text was updated successfully, but these errors were encountered: