-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Pure win32 / opengl example #1553
Conversation
Thank you! Linking to #281. |
Ok, I'll see if I can put a bit more time into it these next days.. |
Don't sweat it too much too, because I'll be reworking the example structure in the next month-ish so I expect to take over this example anyway (and it'd be easy for me to tweak it). This is already a very good base for me to start from. Features like #1542 requires a bit of a reorganization of the input handling and window management. I have it working in a private branches but I'm currently evaluating how feasible it is to use in various engines and I don't know what's the right level of abstraction yet. |
Wow! |
They should all follow the same structure. In your case the GLFW+GL3 example for the GL part, and the DirectX11 example for the Win32 part. |
@n00bmind Note that the examples/ have been refactored very recently. It would be easier today to recreate something like your PR by combining imgui_impl_win32.cpp and e.g. imgui_impl_opengl2.cpp and the missing glue in main.cpp. Such example would be nice, if you are interested in starting from here and recreating one. |
Hi Omar, |
Ok I just 'restarted' my fork following the new structure etc. (github wanted to close this for some reason). |
Oh, I just noticed a "small" annoyance, which makes me doubt how to proceed.. imgui_impl_opengl3.cpp already includes gl3w.h for bindings. |
Thanks! I initially choose gl3w for the examples because it was smaller than other solutions. I would say for now using gl3w instead of glext.h may be preferable as a first step, if only because it is already on the repo (so your commit would have to be squashed). Is glext.h more standard? I'm not against transitioning to something else e.g. glext.h later if it simplify the portability of examples. But glext looks like a dependency similar to gl3w that we have to bundle? If we used it we could move it to examples/libs/.
This is a recurrent issue for many users, which forces them to copy and edit that file to change the include. It's unfortunately tricky to handle that with OpenGL.. :( I was considering adding a set of #define that imgui_impl_opengl3.cpp would use and support gl3w/glad/glew/glext etc. One advantage being that the #ifdef/#include pairs would be explicit so people would understand the issue better and understand the imgui_impl_opengl3 is "compatible" with their existing loading. And ideally can add the define to their build system (or imconfig.h). Worse case they still edit things out. The addition of a GL3+ example for apple system faces the same need (#1873). Could you format all the code in main.cpp to use the same format as other examples? e.g. |
I've never used gl3w before, I'll take a look and compare against using glext directly and get back to you.. |
Ok, I've switched to using gl3w for now.. I don't see any major problems and switching was pretty easy, so if you want me to proceed with this route, I'm ok with that.
On the other hand, it's a bit more code on the client side, but it's also code that very seldom will change.. Yes, like you mentioned, glext.h would have to be included in the libs dir for convenience (wglext.h also, and possibly its equivalent for other platforms..) One other thing, I created a VS project, but the earliest version I have is 2015, so I don't know how compatible it would be with older versions.. |
Thanks. We can tackle the glext vs gl3w later, we can go this route first. For now make sure to squash the commits to remove the big files from history.
Seems equivalent to gl3w except the functions are explicitly initialized in main.cpp. You'll also want to update examples/README.md. You can copy one of the existing 2010 project as a base, change the filename manually and/or request 2015 to not upgrade them and keep them 2010. It's a good test as by default it means we'll stay with older C++11 compliance and older Windows SDK as well. |
I don't really know how to squash commits, but I'll look it up.
Well, not really, gl3w makes you link against gl3w.c. I'll try an take care of the readme, project, formatting etc. when I get home today. |
Ok, I think this is mostly there.. would that work? |
Normally if you rebase and merge your multiple commit into 1 commit when the file will be gone. For |
I actually don't think I use it for any functions.. I only use it for a few symbols like WGL_CONTEXT_MAJOR_VERSION_ARB and the like.. it would be perfectly possible to define those by hand too I guess. |
Hope I did everything right there with the squashing.. (I'm not too proficient in git). |
Minor suggestions:
(I'm just telling that this pr is slightly different from other windows impls. I really appreciate your changes, it's awesome!) |
0c1e5bd
to
bb6a60b
Compare
8b83e0a
to
d735066
Compare
b3b85d8
to
0755767
Compare
c817acb
to
8d39063
Compare
Closed/solved, see #3218 (comment) |
This version uses just Win32 to process all input and output, and binds only the necessary OpenGL functions using the function types defined in glext.h (included), so it has no dependencies whatsoever.
Take a look at how the code is distributed because it is taken quite directly from my own engine, so you may prefer things arranged in a different way.