-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Add native winapi OpenGL example #3218
Conversation
@ocornut is there something you want me to change on this, or add? |
4a6447b
to
6822493
Compare
40237fe
to
5044077
Compare
Rebased on the new docking branch, |
5044077
to
5794750
Compare
Sorry for the late answer.... I'm digging through the many PR attempting this and every one of them has issue. Would it make sense to add a |
I don't see this being simpler than #6086, but this did have platform windows working. The reason why there was not a lot of new coded added, was because the opengl2 backend did already bring everything that was needed, |
@ocornut do you want me to fix the merge conflict here, or are you going to move forward with another PR? |
Hello, Your PR seems simpler as it requires much less involvement from imgui_impl_win32, which is better. The question is will it work with the opengl3 backend? I don't think it will conflict much so probably easy to fix conflicts. May I suggest to change: IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd, bool platformHasOwnDC = false); to IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
IMGUI_IMPL_API bool ImGui_ImplWin32_InitForOpenGL(void* hwnd); |
@ocornut I have changed the code to use |
While experimenting I noticed that the example worked even when calling Can you clarify why you said CS_OWNDC is needed? Things works well here and although this is putting a little more responsibility on user app, I think the complexity trade-off is well worth it and this may be the best solution to this problem. |
Khronos specifies it: This StackOverflow post goes into some detail:
|
I went through this and merged, was a little bit tedious as had to split this but it's now done.
Closing... 🥁 🥁 🥁 🥁 🥁 Your solution won, but I'm assuming we may need to revisit something and I honestly worry this "low-level" example may attract issues so I am explicitly NOT recommending people using it, best to stick to SDL or GLFW for OpenGL. We'll see. Thanks a lot! |
Anything specific you need to do on core context creation to get this working? Here's the code if anyone has an idea 🤷♂️ https://gist.github.com/wrightwriter/4666c989eadba9b8932bf632b01b00f1 |
When I encountered this issue, I discovered it was because my main window PFD wasn't the same as the PFD that is being used by the child windows when you draw an imgui window out. Since I used the example code 1:1, all I did was change the PFD in the example code to be the same PFD I used as my main window. Hopefully if someone comes along, maybe this will help. |
Mashed together DirectX9 + glfw opengl2 into a new example that runs on Winapi + OpenGL2
Built on Visual studio 2017, win10, docking branch.
Platform windows work:
Project downgraded to use the same platform toolset as the rest.