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

Re: [pygame] Sprite rotation



Todd Smith wrote:

how well does pygame (SDL) handle sprite rotation vs. pyopengl?
Not nearly as well. In SDL, the rotation is done in software, versus pyopengl which uses your graphics hardware. Also, SDL is tied to the notion of an axis-aligned rectangle (the image rotates, but it still has to be contained inside a rectangle with horizontal and vertical edges), so you have to concern yourself with resizing in order to avoid cropping the image. Whereas with pyopengl, you just rotate the textured quad and that's it.

On the other hand, you have to do a bit more legwork setting up your game to use OpenGL, but not much more. Since almost everyone has a 3D card these days, I would strongly recommend you take advantage of it. The benefits in speed and graphical quality cannot be overstated--it's night and day. Basically, you'll get all your graphics "for free"--I'm talking rotation, scaling, and alpha blending. Your only bottleneck will be Python itself. SDL starts to have problems just drawing the entire screen every frame...you have to mess with things like "dirty rectangle animation" to get decent performance, and you can't have things like smooth scrolling or other effects that change the entire screen every frame. Your graphics card can handle 10,000 textured quads (sprites) with full effects, drawing 60 times a second, without even breaking a sweat. Pyopengl lets you tap that power.

-Eric