[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] performance issues



I'm having a couple of performance issues using pygame (basically as a context for opengl drawing).
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?

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()

--
Jon Peirce
Nottingham University
+44 (0)115 8467176 (tel)
+44 (0)115 9515324 (fax)

http://www.psychology.nottingham.ac.uk/staff/jwp/