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

Re: [pygame] OpenGL with pygame



> This is probably quite far out, but has anybody investigated the
> possibilities to use OpenGL with pygame? Something like PyOpenGL would be
> quite nice to have running someday. 
> 
> No, I don't plan on using OpenGL for at least year in my game, but it
> would be nice to hear experiences from other people. My game uses fairly
> statical graphics and infrequent repaints (1-3 fps), so OpenGL could be
> possible, I think... :-)

i have a bit of experience with opengl, so i keep thinking about
adding this functionality. currently, pygame does have the OPENGL
and OPENGLBLIT flags available, so you should be able to create
the appropriate screen.

this is pretty basic, and not probably not enough to use opengl
with anything serious. the problem is that i've never used 
pyopengl, so i'm really unsure of the best way to do this.

SDL offers some extra functions for working with opengl, 
SDL_GL_SwapBuffers, SLD_GL_Get/SetAttribute, SDL_GL_GetProcAddress,
SDL_GL_LoadLibrary.

the basic plan would be another module (probably named opengl)
with these functions wrapped in it. only problem is that i
expect the "LoadLibrary" and "GetProcAddress" is best left
to the real pyopengl module. pyopengl likely has a swapbuffers
call, (swap buffers part of the support GLX or WGL libraries).
This only leaves the GL_SetAttribute and GL_GetAttribute. The
attributes are used when initializing the SDL display window,
they help SDL choose a correct opengl pixel format.

i really don't want to work on any of this until i've played
with pyopengl a bit. one feature that might be pretty easy to
add would be support for offscreen opengl surfaces. SDL doesn't
offer this functionality, but it should be easy to add in a wrapper
on top of SDL. i was thinking about looking at other python UI
libs that wrap opengl for any added insight. (tkinter, fxpy, wxpython)

if there's anyone out there with pyopengl experience, please
speak up :]   i'll also be looking at other SDL/OPENGL apps in C
to see which parts are clean and which parts are ugly.


well, the opengl module is a little lower priority. it is something
i'd like to implement, but i don't know enough about it to write
something that would be pleasant. if someone knows enough to take
a stab at it, i'd be glad to help get it working.







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