mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-16 19:11:13 +00:00
OpenGL3 backend rendering breaks with GL_PRIMITIVE_RESTART #3544
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#3544
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?
Version: 1.79
Branch: master
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: GCC 10.0.1
Operating System: Ubuntu 20.04
If I take the GLFW/OpenGL3 example and add

glEnable(GL_PRIMITIVE_RESTART);just before the main loop, the result looks like this:The problem does not occur if I wrap my own OpenGL calls in
glEnable(GL_PRIMITIVE_RESTART);/glDisable(GL_PRIMITIVE_RESTART);each frame. I'm not experienced with OpenGL so I'm not sure if this is supposed to work like that or if it's a bug in the backend implementation.Thanks for reporting this.
Strictly speaking it technically a “bug” but those are endless as OpenGL is a state machine with hundred of states (made more complicated by the many flavors and versions of GL).
As you can see in the backend code we backup/change/restore many state so it would be a matter of adding this to the list of backed up state. (While carefully only calling it for the appropriate GL version)
Realistically speaking, if your OpenGL code wants to interact with any other OpenGL code it is most likely to need to restore any state that the foreign code is unaware off, so your solution would work just as well. But we’re happy to add more to the list of restored state in the backend if it helps.
Yes, I can see how it would be difficult to cover all such situations. I think you should decide yourself if you want to handle this particular case.
This is now fixed by
ffe8f0177fcourtesy of @Xipiryon.