Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug of GL ERROR when window is minimized #486

Closed
wants to merge 1 commit into from

Conversation

maxint
Copy link

@maxint maxint commented Jan 15, 2016

Add more information.

In GLFW implementation, glfwGetWindowSize(g_Window, &w, &h) and glfwGetFramebufferSize(g_Window, &display_w, &display_h) return zero width and height when render window is minimized. Then glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height) reports GL_ERROR when zero parameters.

Thanks for this tiny, handful and great open source project!

@ocornut
Copy link
Owner

ocornut commented Feb 8, 2016

Thanks. I'll reapply this manually as the PR seems to have unrelated changes (imgui_internal, spacing).

if (fb_width == 0 && fb_height == 0)
        return;

Should perhaps be:

if (fb_width == 0 || fb_height == 0)
     return;

and

io.DisplayFramebufferScale = ImVec2((float)display_w / ImMax(1, w), (float)display_h / ImMax(1, h));

should be

io.DisplayFramebufferScale = ImVec2(w ? ((float)display_w / w) : 0, h ? ((float)display_h / h) : 0);

So as to not assign a resolution value into a scale value.

@maxint
Copy link
Author

maxint commented Feb 16, 2016

You are right, I have merge old and new changes into one commit.

ocornut added a commit that referenced this pull request Feb 16, 2016
@ocornut
Copy link
Owner

ocornut commented Feb 16, 2016

Applied manually now. Thanks!

@ocornut ocornut closed this Feb 16, 2016
@maxint
Copy link
Author

maxint commented Feb 18, 2016

It's my pleasure 😄

ocornut added a commit that referenced this pull request Mar 6, 2016
@ocornut
Copy link
Owner

ocornut commented Mar 6, 2016

@maxint Sorry when I manually applied that the other day I actually let the early-return happen at the wrong spot and it caused problems (which your PR didn't have). It is fixed now.

@maxint
Copy link
Author

maxint commented Mar 8, 2016

@ocornut Got it. Thanks for your information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants