[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] OpenGL AND Pygmae Sprites on the same display???




On Friday, July 12, 2002, at 02:19 AM, adeptus wrote:

> I've been confusing myself checking out the PyOpenGL and PYGame docs...
>  
> Is it one or the other?

No. It can be both. E.g. the Vision Egg http://www.visionegg.org .  Not 
much on the pygame side other than opening windows and getting events, 
but pygame works for that!

> Or is there some way to allocate python surfaces and then "magically" 
> (magically because I can't figure out how to do it. :) ) blit them to 
> the relevant OPENGL surfaces?

I don't know about pygame sprints, but if you drew it in software you 
presumably have a copy of it in RAM.  In which case you can paste it 
into an OpenGL texture and do whatever you want with it.  I have not 
tried this with pygame primative, but it works if you can get the pixel 
data, which I've done with images and numpy arrays.

> Assuming this is possible, am I being realistic in expecting Pygame to 
> be able to handle rendering primitives and moderate textures to openGL 
> and having semi transparant sprites in the forground?

It's possible to do decent amounts of OpenGL work in python without 
skipping frames.  Check out the Vision Egg website (timing page) and the 
demos.

> I'm about to sleep after hour 36, so forgive me if none of this makes 
> any sense...

Of course, if you wanted to attempt to render every blade of grass and 
every puff of wind on a summer's day using OpenGL, python might not be 
the ideal final solution.  But I bet it would get your prototypes done 
and working long before the C code you'd have to rewrite was working.  
And at that point, you could recode just the speed critical bits in C.  
After all, pygame is a wrapper around SDL, PyOpenGL is a wrapper around 
OpenGL, and python is great at incorporating C extensions (for me, 
editing a setup.py script sure beats a makefile to compile stuff in C!).

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org