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

Re: [pygame] Using PyOpenGL for 2D graphics



"Ian Mallett" <geometrian@xxxxxxxxx> wrote:
> Try looking at glOrtho2D() or something like that...

Yes, glOrtho() or glOrtho2D() both work.


> Why do you want to use
> PyOpenGL for 2D-ness?  It's much better suited to 3D stuff.

Well, just because OpenGL was designed for 3D doesn't mean it's not also a
very good tool for 2D.

Some reasons I prefer OpenGL for 2D to SDL's drawing code:

- performance
- sub-pixel positioning
- scaling/rotation
- blending
- vertex coloring
- lots of good documentation, lots of sample code, lots of tips on
optimizing performance available on the web

Basically, a lot of the graphical features I might want to use in a 3D
renderer, I might also want to use in a 2D renderer.


> I've always
> found it easier to use pygame for 2D games.  Oh, and ummm...  Don't tell
> Silicon Graphics, but I've found pygame is much much faster at 2D.

I'm in the other camp - I find OpenGL easy and fast, and if I want to
reuse code from a 2D game in a later 3D project, the port will be much
easier than if I have to rewrite it from SDL to OpenGL.

-Dave LeCompte