Skip to content

Conversation

@anasrar
Copy link
Contributor

@anasrar 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

@anasrar
Copy link
Contributor Author

anasrar commented Oct 11, 2024

Reference #325


// Install extra callback
glfwSetWindowRefreshCallback(window, glfw_window_refresh_callback);
glfwMakeContextCurrent(NULL);
Copy link
Collaborator

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)

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

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 130

I'll revert.

Copy link
Collaborator

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

Copy link
Contributor Author

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.

@anasrar anasrar requested a review from gucio321 October 14, 2024 01:06
@gucio321 gucio321 merged commit 25d6b87 into AllenDang:main Oct 19, 2024
5 checks passed
gucio321 added a commit to gucio321/cimgui-go that referenced this pull request Oct 26, 2024
caused ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile fragment shader! With GLSL: #version 130
gucio321 added a commit that referenced this pull request Oct 26, 2024
hotfix(glfwbackend): revert part of #348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants