Skip to content
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 Rendering State Features #68

hofstee opened this issue Oct 27, 2019 · 3 comments


Copy link

@hofstee hofstee commented Oct 27, 2019

In the imgui example, there's a set of comments here that say it's sufficient to do this in the renderer constructor if you're only drawing imgui elements.

    /* Set appropriate states. If you only draw imgui UI, it is sufficient to
       do this once in the constructor. */

Which suggests you can just comment out these lines:

    // /* Reset state. Only needed if you want to draw something else with
    //    different state next frame. */
    // GL::Renderer::disable(GL::Renderer::Feature::ScissorTest);
    // GL::Renderer::enable(GL::Renderer::Feature::DepthTest);
    // GL::Renderer::enable(GL::Renderer::Feature::FaceCulling);
    // GL::Renderer::disable(GL::Renderer::Feature::Blending);

While this comment seems valid on Emscripten, at least when I build locally with SDL2 this doesn't work. By doing nothing other than commenting out the line disabling the scissor test, I get those solitaire card effects or glitchy Windows95 things being dragged and I get a trail of the old imgui windows.

Frankly, I'm somewhat baffled.

That being said, I probably have an odd setup. I'll just list what I think would be relevant.

  • imgui version: docking branch
  • OS: Debian running in ChromeOS
  • Window manager: Wayland
  • SDL2 version:
libsdl2-2.0-0/oldstable,now 2.0.5+dfsg1-2 amd64 [installed,automatic]
  Simple DirectMedia Layer

libsdl2-dev/oldstable,now 2.0.5+dfsg1-2 amd64 [installed]
  Simple DirectMedia Layer development files
  • Info from Magnum
Renderer: virgl by Red Hat
OpenGL version: 4.3 (Core Profile) Mesa 19.2.0-devel
Using optional features:
Using driver workarounds:

This comment has been minimized.

Copy link

@hofstee hofstee commented Oct 27, 2019

I poked around a bit more and found an imgui issue about something similar: ocornut/imgui#874

If that's accurate, then the line resetting the scissor test back to its initial state is required to be there, but the others can be omitted.


This comment has been minimized.

Copy link

@mosra mosra commented Oct 27, 2019


You're right -- thinking about it, what happens there is the framebuffer clear at the beginning of drawEvent() being affected by the enabled scissor test from previous frame, clearing only a very tiny part of the screen and leaving the Solitaire trail when you drag windows :)

I'll clarify that in the example code.

@mosra mosra added this to the 2019.1c milestone Oct 27, 2019
@mosra mosra added this to TODO in Project management via automation Oct 27, 2019

This comment has been minimized.

Copy link

@mosra mosra commented Nov 6, 2019

While attempting to document this, I realized it's easier and simpler to just reset the scissor back in the renderer itself. So that's done in mosra/magnum-integration@e0d2e38.

Thanks for the report!

@mosra mosra closed this Nov 6, 2019
Project management automation moved this from TODO to Done Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.