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

Re: [pygame] Using PyOpenGL for 2D graphics



Never tried that...  The way I do 2D interfaces is to draw them after everything else at the near clipping plane after a call to glLoadIdentity()

On 7/8/07, kschnee@xxxxxxxxxx <kschnee@xxxxxxxxxx> wrote:
On Mon, July 9, 2007 12:51 am, Jasper wrote:
> Using openGL for 2D allows you to take advantage of 3D graphics cards
> for smooth scrolling and zooming, or to tilt otherwise 2D game boards into
> 2D.  I also suspect that it'll let you handle more objects on the
> screen at once (especially if they're duplicates), although I haven't done
> comparison tests for this.

I came across a set of tutorials besides NeHe that are worth referring to,
but I've not got the link on me at the moment.

I'm probably repeating myself, but:

I've been interested in using OpenGL with Pygame for some time, and got to
the point of writing a cube-based rotating "landscape" and a
triangle-based textured landscape with a billboarded sprite.
Unfortunately, I found that I didn't know how to combine OpenGL 3D
graphics with any sort of 2D graphics operations, since you can't just
draw an OpenGL screen and then use Pygame graphics functions to paint atop
it. That means no interface and no text, hence no game. I've tried several
times to use various libraries purportedly for doing that sort of thing,
but have not been able to make any of them work in the limited time
available to me, especially using Windows and my homebrew GUI module.
Every so often I go at it and give up again.

What I'd like is a stupidly simple textured 3D landscape with billboarded
sprites, maybe even viewed from a constant camera angle, with a
decent-looking skybox and an easy way to draw my interface atop that. I'd
even be happy using a flat landscape, ie. a plane that can be tilted and
zoomed. The particular requirements of my game do require, though, that I
load a really big array of heights at once, or be able to load new points
on the fly. For now I've got a working Pygame 2D system using tiles.

What do you think of PyOgre? I haven't looked into it lately, but the last
time I worked with it:
-Creating a small landscape with a nice sky was easy
-The official interface system, CEGUI, wasn't working in Python and I had
to cobble together a barely-working UI of my own
-It wasn't clear to me how to do sprites

When working with 3D there's also the concern with the use of sprites vs.
3D characters. The latter seem to be a lot harder to do, and don't look as
good for the same level of skill.