redblobgames / helloworld-sdl2-opengl-emscripten

Basic program that uses SDL2+OpenGL, compiling both locally and via emscripten

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update to ImGui's platform+renderer code

redblobgames opened this issue · comments

When I first wrote this, I took Dear ImGui's combined sample code and modified it to do what I wanted. This is mostly in render-imgui.cpp. This treats ImGui as just another output layer in my code.

However, Dear ImGui isn't just another layer. It needs to know more about the window layer, especially in the newer version of Dear ImGui, which support multiple windows, etc.

I think perhaps I should restructure the code so that ImGui is a the top level instead of being a rendering layer. It should receive events first, and pass only unhandled events to the rest of the code.

In addition, I would like to reuse imgui/examples/imgui_impl_opengl3.cpp and imgui/examples/imgui_impl_sdl.cpp . However, imgui_impl_opengl3 is for emscripten with webgl2, and doesn't handle emscripten with webgl1.