-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
ImGui as a generic graphics API #530
Comments
I've been actually doing this and using ImDrawList as a base for some simple prototyping (using callbacks to change render states). You can create a window with 0.0f alpha background and a few flags ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoInputs|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_NoFocusOnAppearing and you'll pretty much get an empty draw list to use. Use SetNextWindowSize/Pos to make the window fullscreen. Alternatively you can also just create an ImDrawList and pass it to your renderer somehow. |
Nice - I tried a while back to "break out" of the window - didn't think of just making the window fullscreen and setting those style flags! So really I guess it already supports this - though I think a more concise way of opening a fullscreen, invisible window as a canvas could be cool, like ImGui::BeginCanvas() or something - mainly for drawing overlays. I imagine it's pretty easy to write a BeginCanvas function around the stuff you just mentioned in your comment so I'll try that out I think - feel free to close out if you feel that it's not something that should be added to core ImGui! |
Right now I don't feel anything is needed apart from a little more control over ordering/layering of windows. Something like There's also GImGui->OverlayDrawList in imgui_internal.h which is the drawlist used for the mouse cursor and I sometimes use, thinking about exposing it in imgui.h as a convenience. I suggest you play around with those techniques see if you feel additions are desirable. |
Could it be possible to have |
@dkrikun ImGui is render api agnostic.You can either render your OpenGL stuff in a texture and render that texture in your ImGui window, or add a callback via the ImDrawList api and rendernig your OpenGL stuff when the callback is called. |
It certainly is, what I meant is whether it could be possible to have some |
That render-to-texture wouldn't be a portable thing. |
Enhancement idea. Forgive me if this has been requested before!
The drawlist functionality of (dear) ImGui is really powerful - i.e. ImDrawList::Add* functions. I've actually thought about using ImGui as a basic renderer for prototyping stuff. All you'd need is access to the root window/desktop/background, and the ability to use a raw ImDrawList to draw your state (polys, circles, images, etc.).
Using this you could write games and even more bespoke UI systems.
Ever considered this? I'm thinking about forking and giving it a go myself, actually.
The text was updated successfully, but these errors were encountered: