Gldrawarrays Only Updates When I Exit
I have this code in python3 which doesn't work on windows machines but it worked on a linux machine. I draw a green screen and a red triangle but the red triangle only appears when
Solution 1:
I draw a green screen and a red triangle but the red triangle only appears when i exit.
If the display mode is pygame.OPENGL
, pygame.display.flip()
performs a GL buffer swap.
You need to enable double buffering by setting the pygame.DOUBLEBUF
display mode flag (see pygame.display.set_mode()
):
screen = pygame.display.set_mode((800, 600), pygame.OPENGL | pygame.DOUBLEBUF)
If you do not want to use double buffering, you must force the execution of GL commands manually with glFlush()
:
run = Truewhile run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False# [...]
gl.glFlush() # force the execution of GL commands
Post a Comment for "Gldrawarrays Only Updates When I Exit"