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

Re: [pygame] using opengl in pygame?



On Sun, 20 Jun 2004, Jacob Schwartz wrote:

> Imagion the sitation where I have 30 different character sprite sheets, 
> each with 300 frames of animation each not very many for a 2d game.
> Plus, add HUD images, menu images, all the extras that come up in a game 
> (particles, mouse cursors, etc)

Ah, so you want to handle everything on the hardware.  I suspect this may be
overkill, and I wouldn't go this far until profiling showed it was a clear
problem.

Unless you are animating most of the screen all the time, I suspect you
could preload these images onto pygame Surfaces and handle them from there.
IMHO what OpenGL really gets you in a 2D game is the ability to smoothly
scroll/zoom without animating the entire image.

However, I'm working on a turn based strategy game with modest animation
requirements, so your millage may varry.  Still premature optimization is a
killer!


> Perhaps there is a dynamic which could run some sort of bin-packing 
> algorithm to best use the video memory to free me of having to deal with 
> this problem, and just load images as I would with a 2d api?

I don't believe so.  OpenGL from my experience is very "hands on".


As a side note, I'm actually extending to using several stacked surfaces, so
that I can keep a seperate one for things like transparent hex grids and
province boundaries, which otherwise are hard to blit in isolated pieces
without recursively dirtying everything else.

-Jasper