|
@@ -39,15 +39,15 @@ void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
|
|
GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
|
|
GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
|
|
|
GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
|
|
- GLint last_blend_src; glGetIntegerv(GL_BLEND_SRC, &last_blend_src);
|
|
|
- GLint last_blend_dst; glGetIntegerv(GL_BLEND_DST, &last_blend_dst);
|
|
|
- GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
|
|
- GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
|
|
+ GLint last_blend_src; glGetIntegerv(GL_BLEND_SRC, &last_blend_src);
|
|
|
+ GLint last_blend_dst; glGetIntegerv(GL_BLEND_DST, &last_blend_dst);
|
|
|
+ GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
|
|
+ GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
|
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
|
|
- GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
|
|
- GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
|
|
- GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
|
|
- GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
|
|
+ GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
|
|
+ GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
|
|
+ GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
|
|
+ GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
|
|
|
|
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
|
|
|
glEnable(GL_BLEND);
|
|
@@ -110,12 +110,12 @@ void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
|
|
|
glBindVertexArray(last_vertex_array);
|
|
|
- glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
|
|
- glBlendFunc(last_blend_src, last_blend_dst);
|
|
|
- if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
|
|
|
- if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
|
|
- if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
|
|
- if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
|
|
+ glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
|
|
+ glBlendFunc(last_blend_src, last_blend_dst);
|
|
|
+ if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
|
|
|
+ if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
|
|
+ if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
|
|
+ if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
|
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
|
|
}
|
|
|
|
|
@@ -170,7 +170,7 @@ void ImGui_ImplGlfwGL3_CreateFontsTexture()
|
|
|
int width, height;
|
|
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
|
|
|
|
|
|
- // Create OpenGL texture
|
|
|
+ // Create OpenGL texture
|
|
|
glGenTextures(1, &g_FontTexture);
|
|
|
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
@@ -356,13 +356,13 @@ void ImGui_ImplGlfwGL3_NewFrame()
|
|
|
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
|
|
|
if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED))
|
|
|
{
|
|
|
- double mouse_x, mouse_y;
|
|
|
- glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
|
|
|
- io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.)
|
|
|
+ double mouse_x, mouse_y;
|
|
|
+ glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
|
|
|
+ io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- io.MousePos = ImVec2(-1,-1);
|
|
|
+ io.MousePos = ImVec2(-1,-1);
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|