-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Closed
Description
Version: 1.80
Branch: master
Back-ends: imgui_impl_opengl2.cpp + imgui_impl_glut.cpp
Compiler: MSVS 2003
Operating System: Win 10 Pro
ImGUI has aliased object / glyphs in OpenGL2 backend if shade mode is flat
Before fix applied: See jagged edges around arrow glyphs, scrollbar thumb button and window border chrome:
After fix applied: those things look smooth (and if zoomed in, seem alpha-blended as expected):
The problem occurs when the OpenGL render state was using
glShadeMode(GL_FLAT)
The fix is to put this line inside ImGui_ImplOpenGL2_SetupRenderState:
glShadeModel( GL_SMOOTH ) ; // MJG added 2020 December to get multisampling (anti-aliasing) to work on ImGUI glyphs.
See also Issue 3668 for other OpenGL render state that needs to be set up to render ImGUI as expected:
glDisableClientState(GL_NORMAL_ARRAY); // in case last render happened to have a vertex buffer with normals
glDisable( GL_STENCIL_TEST ) ;
glBindBuffer( GL_ARRAY_BUFFER , 0 ) ; // in case last render happened to use VBO
glDisable( GL_TEXTURE_CUBE_MAP ) ; // in case last render happened to use a cubemap texture