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

Re: [pygame] display driver



David Mallwitz wrote:

What is the correct way to get hardware acceleration with Pygame + PyOpenGL? The snippet below seems to indicate that I've got software rendering with the DirectX driver, and my CPU usage hits 80% with just a simple rotating wireframe teapot so I'm inclined to agree. This is on a Win2K system with an Nvidia card and recent drivers.

Depending on how you did your loop it may be using up 80% of resources.

If you loop as fast as you can it will basically use up as much of the resources as possible.

If you have the latest nvidia drivers installed it is probably running opengl accellerated.

How many frames per second do you get? Have you tried any of the demos which come with pyopengl.



>>> import pygame
>>> from pygame.locals import *
>>> pygame.init()
(6, 0)
>>> pygame.display.set_mode((1024,768), OPENGL|DOUBLEBUF)
<Surface(1024x768x32 SW)>
>>> pygame.display.get_driver()
'directx'

I've read Pete's DisplayModes tutorial and the NewbieGuide and run through the online docs, but ended up with no definitive answers. HWSURFACE, HWPALETTE, FULLSCREEN, HW_ACCEL - what is the magic incantation?

Dave


You are setting up opengl correctly ie (OPENGL|DOUBLEBUF). However there is no simple way to detect if you are using accelerated drivers or not.

It's possible to build a function to query opengl, and test to see what info is returned. Then you'd need to parse that for the known non accelerated opengl versions(the ms dll, the sgi dll, or one of the messas).