Jon Peirce wrote:
I'm having a couple of performance issues using pygame (basically as a context for opengl drawing).SDL tries to be safe when choosing the refresh rate. So it chooses the lowest value. afaik there is no way in sdl to choose refresh rate. There has been talk of it on the sdl mailing list of fixing this, not sure if anything has made it into the source yet(maybe try asking on that list).
I'm running on a windows box (3GHz P4 with NVidia FX5200 on a CRT display), and I generally synch buffer-swaps to the frame.
1) If I create my pygame display in fullscreen mode it defaults to 60Hz refresh rate which is no good for my purposes. The same code running windowed inherits the monitor rate, which is fine. Using GLUT instead of pygame there's no problem so it isn't something inherent to my system. Is there any way to control frame rate programatically, or at least to force it keep at the same rate as before?
2) After a few seconds there's a significant disk access that causes a frame rate drop (regardless of what/how much I draw to the screen). Maybe a module is being initialised late - after I've already started drawing? Does anyone else have this problem?Can you wait until the disk access has past? Does it happen on different platforms/systems?
For game development these probably wouldn't be a problem but I'm using it for visual stimuli (www.psychopy.org) and timing needs to be precise. Below is minimal code for demo.
Jon
#------------------------------------------------- import pygame from OpenGL import GL #setup pygame pygame.init() winSettings = pygame.OPENGL #winSettings = winSettings|pygame.FULLSCREEN myWin = pygame.display.set_mode([800,600],winSettings) #setup openGL GL.glClearColor(1.0, 1.0, 1.0, 1.0) GL.glClear(GL.GL_COLOR_BUFFER_BIT) pygame.display.flip() pygame.time.delay(10000) pygame.quit()
This example doesn't run. How it would show either problem? Have fun!