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 opengl issue in Window init #3059

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

Starbuck5
Copy link
Member

@Starbuck5 Starbuck5 commented Aug 17, 2024

Fixes #3056

I can't actually test this on Windows because it's impossible to get framebuffer acceleration on Windows in SDL2:

#if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */
        if (_this->CreateWindowFramebuffer && (SDL_strcmp(_this->name, "windows") == 0)) {
            attempt_texture_framebuffer = SDL_FALSE;
        }
#endif

@Starbuck5 Starbuck5 added bugfix PR that fixes bug window pygame.Window labels Aug 17, 2024
@Starbuck5 Starbuck5 requested a review from a team as a code owner August 17, 2024 06:38
@Starbuck5 Starbuck5 marked this pull request as draft August 17, 2024 06:38
@ddorn
Copy link
Contributor

ddorn commented Aug 17, 2024

On linux + wayland + swaywm, it does work! I'm not entirely sure I installed the branch correctly, but I see a red screen instead of black and I get opengl = False with this code:

import pygame
 
win = pygame.Window()
surf = win.get_surface()  # get the window surface
print(f"{win.opengl=}") 

while True:
   for event in pygame.event.get():
      if event.type == pygame.QUIT:
            pygame.quit()
            raise SystemExit
 
   # draw something on the surface
   surf.fill("red")
 
   win.flip()  # update the surface to the window

@rethanon
Copy link
Contributor

rethanon commented Aug 17, 2024

As mentioned on #3056 I've tested this fix on my intel MacBook Pro and the PR fixes the issue (and print(win.opengl) returns false whereas before it was returning True)

@oddbookworm oddbookworm marked this pull request as ready for review August 17, 2024 17:54
@Starbuck5 Starbuck5 changed the title Fix imposter opengl (hopefully!) Fix imposter opengl Aug 17, 2024
Copy link
Member

@oddbookworm oddbookworm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the PR 🥳

@ankith26 ankith26 added this to the 2.5.2 milestone Aug 17, 2024
@Starbuck5 Starbuck5 merged commit ebf7edd into pygame-community:main Aug 17, 2024
25 checks passed
@Starbuck5 Starbuck5 deleted the fix-imposter-opengl branch August 17, 2024 18:29
@ankith26 ankith26 changed the title Fix imposter opengl Fix opengl issue in Window init Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR that fixes bug window pygame.Window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mac - pygame.Window.flip() seemingly doesn't work since v2.5.0.dev4 was implemented
5 participants