@ -96,7 +96,7 @@ static bool ImGui_ImplOpenGL3_CreateFontsTexture()
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
unsigned char * pixels ;
unsigned char * pixels ;
int width , height ;
int width , height ;
io . Fonts - > GetTexDataAs Alpha8 ( & pixels , & width , & height ) ; // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
io . Fonts - > GetTexDataAs RGBA32 ( & pixels , & width , & height ) ; // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
// Upload texture to graphics system
// Upload texture to graphics system
GLint last_texture ;
GLint last_texture ;
@ -109,7 +109,7 @@ static bool ImGui_ImplOpenGL3_CreateFontsTexture()
if ( g_IsGLES | | g_GlVersion > = 2000 )
if ( g_IsGLES | | g_GlVersion > = 2000 )
glPixelStorei ( GL_UNPACK_ROW_LENGTH , 0 ) ;
glPixelStorei ( GL_UNPACK_ROW_LENGTH , 0 ) ;
glTexImage2D ( GL_TEXTURE_2D , 0 , GL_R 8, width , height , 0 , GL_RED , GL_UNSIGNED_BYTE , pixels ) ;
glTexImage2D ( GL_TEXTURE_2D , 0 , GL_R GBA, width , height , 0 , GL_RGBA , GL_UNSIGNED_BYTE , pixels ) ;
// Store our identifier
// Store our identifier
io . Fonts - > TexID = ( ImTextureID ) ( intptr_t ) g_FontTexture ;
io . Fonts - > TexID = ( ImTextureID ) ( intptr_t ) g_FontTexture ;
@ -249,7 +249,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
" varying vec4 Frag_Color; \n "
" varying vec4 Frag_Color; \n "
" void main() \n "
" void main() \n "
" { \n "
" { \n "
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st) .r ;\n "
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st) ;\n "
" } \n " ;
" } \n " ;
const GLchar * fragment_shader_glsl_130 =
const GLchar * fragment_shader_glsl_130 =
@ -259,7 +259,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
" out vec4 Out_Color; \n "
" out vec4 Out_Color; \n "
" void main() \n "
" void main() \n "
" { \n "
" { \n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) .r ;\n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) ;\n "
" } \n " ;
" } \n " ;
const GLchar * fragment_shader_glsl_300_es =
const GLchar * fragment_shader_glsl_300_es =
@ -270,7 +270,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
" layout (location = 0) out vec4 Out_Color; \n "
" layout (location = 0) out vec4 Out_Color; \n "
" void main() \n "
" void main() \n "
" { \n "
" { \n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) .r ;\n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) ;\n "
" } \n " ;
" } \n " ;
const GLchar * fragment_shader_glsl_410_core =
const GLchar * fragment_shader_glsl_410_core =
@ -280,7 +280,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
" layout (location = 0) out vec4 Out_Color; \n "
" layout (location = 0) out vec4 Out_Color; \n "
" void main() \n "
" void main() \n "
" { \n "
" { \n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) .r ;\n "
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st) ;\n "
" } \n " ;
" } \n " ;
# ifndef NDEBUG
# ifndef NDEBUG