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 the resolution issues when create full screen app #20043

Closed
wants to merge 1 commit into from

Conversation

Mee-gu
Copy link

@Mee-gu Mee-gu commented Aug 16, 2019

fix the resolution issues when creating a full-screen app.
the issue is discussed here

@minggo
Copy link
Contributor

minggo commented Aug 19, 2019

glfw can register callback for resolution changing, i think it is more reasonable to do some operation there.

@Mee-gu
Copy link
Author

Mee-gu commented Aug 19, 2019

glfwWaitEvents behaves exactly like glfwPollEvents, glfwWaitEvents is a better choice here since it only needs to update the contents of the window.
Besides, glfwWaitEvents as well as glfwPollEvents can't be called from a glfw callback.

@Bilalmirza
Copy link

Bilalmirza commented Aug 20, 2019

@Mee-gu @minggo
Just few issues I want to point out.
On macbook 2018 15"

1024x640: borders on left and right. cant move the mouse to screen ends either.
fps: 2156

1280x800: works fine
fps: 536

1440x900: works fine
fps: 391

After this it gets weird especially with the fps

1680x1050: works fine... i think the display also loses sharpness you can see some on fonts.
fps: ~1200

1920x1280: works fine
fps: 740

Screenshots: https://www.dropbox.com/sh/4mqxarh3bjj1usx/AADjhHhDqflSqdKvW3fI18AEa?dl=0

@Mee-gu
Copy link
Author

Mee-gu commented Aug 20, 2019

@Bilalmirza As for the black borders on both left and right, I try lots of methods but change nothing. So I create an issue in glfw GitHub hoping for a good workaround.
BTW, I can't view your screenshots, maybe you can directly paste in the edit box.

@Bilalmirza
Copy link

Bilalmirza commented Aug 20, 2019

@Mee-gu any idea why fps is so much better in higher resolutions. probably because of retina being disabled in last 2 i think.

@Mee-gu
Copy link
Author

Mee-gu commented Aug 21, 2019

@Bilalmirza How did you get the fps?

@Bilalmirza
Copy link

Bilalmirza commented Aug 21, 2019

@Mee-gu Appdelegate
director->setDisplayStats(true);

// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0f / 3500);
glfwSwapInterval(0);

@Bilalmirza
Copy link

I think this is the issue
#16561

@Bilalmirza
Copy link

Bilalmirza commented Aug 23, 2019

I have a terrible fix for the fps. It also links the resolution to Display resolution.
You probably wont use this but here it goes.
in info.plist
add "High Resolution Capable" and set it to "NO"
in ccApplication

    NSWindow *nsWindow = glview->getCocoaWindow();
    [nsWindow.contentView setWantsBestResolutionOpenGLSurface:NO];

in CCGLViewImpl-desktop.cpp

    glfwWaitEvents();

//    setFrameSize(rect.size.width , rect.size.height);
    GLView::setFrameSize(rect.size.width , rect.size.height);

this prevents the call on updateFrameSize() // which really messes up the resolution.

now everything is fixed. The higher the display resolution in system preference the better the resolution in game.

@Mee-gu Mee-gu closed this Nov 11, 2019
@Mee-gu Mee-gu deleted the feature/fixFullScreen branch November 11, 2019 03:43
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.

None yet

3 participants