mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Imgui with GLFW breaks my textures #602
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#602
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am having problem with using Imgui + Glfw in my game.
My main loop looks like this:
And my game looks like this (the broken one with the ImGui text):
But it should look like this (when commenting out the begin, text and end):
It also broke my key callback and it is no longer responsive for key presses.
Check that you're restoring your OpenGL state correctly after rendering the
command lists. ImGUI cannot possibly break your rendering since it has
nothing to do with the rendering - it merely gives data that your renderer
will use. Looks like your texture wrapping state is not restored. I may
be wrong.
On Thu, 21 Apr 2016 at 18:29 Zuzana Dostálová notifications@github.com
wrote:
Hello Zuzana,
Assuming you are using the unmodified imgui_impl_glfw_gl3.cpp renderer (please confirm!), it looks like it may be modifying some global GL state. It is in theory saving and restoring all GL state it modifies but looks like something's not being saved.
Publishing what your code is actually doing may help in tracking it down.
Another technique is that you can comment huge chunks of the code in ImGui_ImplGlfwGL3_RenderDrawLists() to diagnose which part of that code is affecting your code.
First comment out the entire rendering loop (the
for (int n = 0; n < draw_data->CmdListsCount; n++)) see if it fixes your rendering. Then you can comment the lines starting from after theBackup GL stateblock, etc. If you can isolate which line(s) are most immediately affecting your rendering we can devise a fix.Callbacks:
When calling ImGui_ImplGlfwGL3_Init() the second parameter
bool install_callbackoverride 4 glfw callbacks. If you need the callback for your own work you should set this parameter to false and call the 4 callbacks yourself (listed in imgui_impl_glfw_gl3.h).Hi,
Thanks all for a great help. Yes, I am using the unmodified renderer.
I managed to find out which line exactly is causing the problem, when I comment it out, it works just fine:
Also, what is weird, when I output the current and last texture just bellow the code from above:
it gaves me the same IDs....
here is my game loop (I rewrite it to SDL meanwhile, but the error is still the same):
OK I think it is fixed now, saving and restoring the glActiveTexture() value.
It broke your code because your code never sets that values again (while it works here and is perfectly legal, it is a little unusual to just set state during initialization and expect it to stay untouched during whole program lifetime. Usually in a bigger application you may want to setup GL state before rendering an object, etc.)
Could you confirm the fix?
Thanks for the report!