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

Very low framerate on osx at any window size above 320x240 #1280

Closed
agdt3 opened this issue Sep 2, 2019 · 1 comment
Closed

Very low framerate on osx at any window size above 320x240 #1280

agdt3 opened this issue Sep 2, 2019 · 1 comment

Comments

@agdt3
Copy link

agdt3 commented Sep 2, 2019

Hello,

I've attempted to implement the most basic example on a screen size above the given 320x240, and my framerate plunged significantly.

Code:

import sys, pygame

pygame.init()

size = width, height = 640, 480
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

ball = pygame.image.load("intro_ball.gif").convert()
ballrect = ball.get_rect()
clock = pygame.time.Clock()

while 1:
    clock.tick(60)
    pygame.display.set_caption("FPS: " + str(clock.get_fps()))
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    ballrect = ballrect.move(speed)
    if ballrect.left < 0 or ballrect.right > width:
        speed[0] = -speed[0]
    if ballrect.top < 0 or ballrect.bottom > height:
        speed[1] = -speed[1]

    screen.fill(black)
    screen.blit(ball, ballrect)
    pygame.display.flip()

Specs:
System: OSX Mojave 10.14.6
Python: 3.7.4 (installed from python bin, not brew, but path shows it to be using the )
Pygame: 1.9.6
SDL: 2.0.9_1 (installed via brew)

Framerates:
320x240 = ~60fps
640x480 = ~17fps
1024x768 = ~6.8fps

I've tried both clock.tick() and clock.tick(60).

Is there anything I'm obviously missing here? Thank you for your help!

Possibly related to #1032, but no solution was provided in that ticket either. I tried enabling SDL_HINT_RENDER_DRIVER=metal SDL_HINT_RENDER_VSYNC=1 as well, with no difference.

@agdt3
Copy link
Author

agdt3 commented Sep 3, 2019

After a bit of experimentation, it looks like changing the display settings to pygame.FULLSCREEN fixes this issue for some reason. Windowed mode remains slow.

@agdt3 agdt3 closed this as completed Sep 3, 2019
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

No branches or pull requests

1 participant