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

Re: [pygame] Hardware acceleration



Can you post your main draw code, and your surface loading code? ( Or
if its not too long, you can post the whole file )

Its possible you are re-loading the images every frame, which would be slow.

Oh, another thing is make sure your screen and your image surfaces are
both using the same pixel format. If they don't, then the surface gets
.convert()-ed every frame, making it slow.

There's also PyOpenGL which lets you use OpenGL from pygame. ( Cards
these days do 2D graphics at a higher FPS if you render them using 3D
rather than a regular 2D blit )

On Tue, Feb 26, 2008 at 5:47 AM, Simon Pickles <sipickles@xxxxxxxxxxx> wrote:
>
> Hi,
>
> Running fullscreen has found a HW surface, but my frame rate is dead! I
> am not doing any reads from the hardware... so why so slow?
>
>
> Casey Duncan wrote:
> > Please post the code you are using to init the display surface.
>        #Hardware
>        flags =  pygame.FULLSCREEN | pygame.DOUBLEBUF | pygame.HWSURFACE
>        #Software
>        #flags =  pygame.NOFRAME
>        self.screen = pygame.display.set_mode((self.width, self.height),
> flags)
>
>        print pygame.display.get_driver()
>        print pygame.display.get_surface()
>
>
> > You may not in fact be getting a hardware surface, try printing the
> > surface object to see what type it actually is.
> On Ubuntu Linux:
> x11
> <Surface(1024x768x32 SW)>
> FPS: 75
>
> On WinXP with HW flags:
> directx
> <Surface(1024x768x32 HW)>
> FPS: 4!!!!!
>
> On WinXP with SW flags:
> directx
> <Surface(1024x768x32 SW)>
> FPS: 75
>
>
> > Also, are you sure drawing is the thing making the framerate too slow?
> > Also, what are you drawing that is slow?
> I am not drawing much. A fullscreen surface to clear the display, then
> several sprites with per-pixel alpha (perhaps 30% of screen area). I've
> posted it here:
> http://img246.imageshack.us/my.php?image=inflation20080226pc7.jpg
>
> Without the per pixel alpha it looks like some sort of 8bit retro game!
> No can do!
>
> Do I need to tell pygame to load the images into video memory? My theory
> is I have a HW surface to which I am copying images each frame from
> system memory.....
>
>
>
>



-- 
Jake