-
Notifications
You must be signed in to change notification settings - Fork 66
refactor(glfwbackend): move clear buffer before render loop #348
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
Conversation
anasrar
commented
Oct 11, 2024
- 08dd44f refactor(glfwbackend): move clear buffer before render loop: allow end user to use OpenGL before render ImGui
- c5bb738 refactor(glfwbackend): keep glfw context after window creation: allow end user to use OpenGL after window creation
|
Reference #325 |
|
|
||
| // Install extra callback | ||
| glfwSetWindowRefreshCallback(window, glfw_window_refresh_callback); | ||
| glfwMakeContextCurrent(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is expected for multi window scenerio (?)
I think that you should keep this and use analogical method in your project and pass (*GLFWBackend).handle() (could make public if necessary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one allow to call OpenGL function after creating window, like compile shader. This behaviour was valid in SDL backend. Otherwise you can only call OpenGL function on render loop or inside AfterCreateContext callback, since OpenGL function need glfwMakeContextCurrent to be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, ok so remove that line instead of commenting it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anasrar this causes
ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader! With GLSL: #version 130I'll revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've investigated a bit more to justify this:
it causes because giu uses mainthread to call Run() in mainthread.
possibly caused by the fact that CreateWindow might be called in another goroutine than Render loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucio321 sure, sorry for the inconvenience.
caused ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader! With GLSL: #version 130
hotfix(glfwbackend): revert part of #348