rswinkle / PortableGL

An implementation of OpenGL 3.x-ish in clean C
MIT License
1.05k stars 49 forks source link

Add Dear ImGui in demo #7

Closed bvernoux closed 1 year ago

bvernoux commented 2 years ago

Could you add the amazing Dear ImGui in demo ? https://github.com/ocornut/imgui

rswinkle commented 2 years ago

I've never used it but from skimming the README, it seems like you could just use the SDL_Renderer backend. Remember PortableGL doesn't actually use/require a real OpenGL context, it's just software rendering and then you do what you want with the rendered frames. I use SDL2 for the examples and demos because it lets you blit framebuffers to the screen. Given that, using the SDL_Renderer backend would probably let you use Dear ImGui and PortableGL at the same time with minimal effort.

Creating a PortableGL specific Dear ImGui backend would be possible, but even starting with an en existing OpenGL backend it would still be far more work.

I'm kind of busy for the next week or so but eventually I'll at least look into the first method. I've thought about doing the same with Nuklear anyway so maybe I'll try both.

billsix commented 2 years ago

I may be able to take a crack at this after I'm done teaching for the semester. Dear IMGUI and Nuklear are both awesome. btw rswinkle I had no idea that you saw my commits regarding fixes on Windows, that's awesome. (I teach graphics at a college and give them a final paper where they get to choose what to study, and I've listed PortableGL as a source of inspiration for them to study. This project of yours is phenomenal work)

I'm building your project using CMake because most of my class uses Windows. If I'm able to get all of the build and example programs working, I'll send you a squashed merge request, should you desire it.

rswinkle commented 2 years ago

Yeah I like to look at the forks occasionally to see what people are doing with PGL, if anything and saw your fixes. D'oh!

That's awesome that you're using it in a class even just as an option for study. That's honestly one of the best ways to use it imo, as a learning tool.

You can actually do anything with Premake that you can with CMake but I don't have windows and working in a VM is a pain so it's never been a priority. Even when I do, I usually use MSYS2 (or more recently WSL) because I'm a Linux/terminal/(neo)vim guy and not a fan of IDE's.

Can't wait till WSL fully supports graphical applications.

Anyway, yeah if you get a parallel windows build system working I'll add it but I don't know/use CMake (seems so overcomplicated compared to Premake imo) so if I ever make any radical change in how I want to do things, I'd probably rely on others to fix it up.

rswinkle commented 2 years ago

Well it's only 4 months late but I went ahead and got a basic Dear IMGUI demo working using the SDL_Renderer backend. It's nothing more than the IMGUI demo with PortableGL on top of it but it shows the important bits about how they can work together.

Let me know if you try it and run into any issues. It has made me curious about adapting the OpenGL3 backend for PGL. It would be a good stress test for PGL's API coverage and behavior so maybe I will end up doing it. I'll leave this open for a while longer till I either do that one too, or decide it's not worth it.

bvernoux commented 1 year ago

I think we can close this issue as Dear ImGui is supported since https://github.com/rswinkle/PortableGL/commit/7771ab278704f43f3b69c5599b4619e047582693