Skip to content
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

OpenGL3 backend rendering breaks with GL_PRIMITIVE_RESTART #3544

Closed
ghost opened this issue Oct 19, 2020 · 3 comments
Closed

OpenGL3 backend rendering breaks with GL_PRIMITIVE_RESTART #3544

ghost opened this issue Oct 19, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 19, 2020

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:
Screenshot from 2020-10-19 13-04-57

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.

@ghost ghost changed the title OpenGL3 backend rendering breaks with GL_GL_PRIMITIVE_RESTART OpenGL3 backend rendering breaks with GL_PRIMITIVE_RESTART Oct 19, 2020
@ocornut
Copy link
Owner

ocornut commented Oct 19, 2020

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.

@ghost
Copy link
Author

ghost commented Oct 20, 2020

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.

@ocornut
Copy link
Owner

ocornut commented Oct 23, 2020

This is now fixed by ffe8f01 courtesy of @Xipiryon.

@ocornut ocornut closed this as completed Oct 23, 2020
ocornut added a commit that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant