|
|
|
@ -28,6 +28,14 @@ static GLuint g_FontTexture = 0;
|
|
|
|
|
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
|
|
|
|
void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
|
|
|
|
{
|
|
|
|
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
|
|
int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x);
|
|
|
|
|
int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y);
|
|
|
|
|
if (fb_width == 0 || fb_height == 0)
|
|
|
|
|
return;
|
|
|
|
|
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
|
|
|
|
|
|
|
|
|
|
// We are using the OpenGL fixed pipeline to make the example code simpler to read!
|
|
|
|
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
|
|
|
|
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
|
|
|
@ -44,14 +52,6 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
|
|
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
|
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context
|
|
|
|
|
|
|
|
|
|
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
|
|
int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x);
|
|
|
|
|
int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y);
|
|
|
|
|
if (fb_width == 0 || fb_height == 0)
|
|
|
|
|
return;
|
|
|
|
|
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
|
|
|
|
|
|
|
|
|
|
// Setup viewport, orthographic projection matrix
|
|
|
|
|
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
|
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
|
|
|