Skip to content

ImGui Rendering State Features #68

Description

@hofstee

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. */
    GL::Renderer::enable(GL::Renderer::Feature::Blending);
    GL::Renderer::disable(GL::Renderer::Feature::FaceCulling);
    GL::Renderer::disable(GL::Renderer::Feature::DepthTest);
    GL::Renderer::enable(GL::Renderer::Feature::ScissorTest);

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:
    GL_ARB_ES2_compatibility
    GL_ARB_direct_state_access
    GL_ARB_get_texture_sub_image
    GL_ARB_invalidate_subdata
    GL_ARB_multi_bind
    GL_ARB_robustness
    GL_ARB_separate_shader_objects
    GL_ARB_texture_filter_anisotropic
    GL_ARB_texture_storage
    GL_ARB_texture_storage_multisample
    GL_ARB_vertex_array_object
    GL_KHR_debug
Using driver workarounds:
    no-layout-qualifiers-on-old-glsl
    mesa-forward-compatible-line-width-range

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions