I have an application that works rather well if OpenGL is initialized like this:
pygame.display.set_mode((w, h), pygame.OPENGL|pygame.DOUBLEBUF, vsync = 0)
While profiling it, I noticed that pygame.display.flip()
takes 99% of the time. I concluded that it's because the processing of the app itself is not very long and so page flipping waits the vblank most of the time (although vsync=0
in the above statement)
To improve performance I have tried to disable double buffering by removing pygame.DOUBLEBUF
(in the hope it would disable the page flips). But this leads to strange results: my program now eats about 100MB/sec. of memory as it goes (whereas before its memory usage was constant). Quitting the program is also affected: it takes about a minute to leave python after exit()
has been called.
So why removing the flag pygame.DOUBLEBUF
has so many unwanted consequences ? It looks like the GPU is buffering commands until the page flip is requested, but I'm not sure, hence my question.
Please note that my apllication is a computation application. I am not interested in waiting for the vsync at all as it looses time.