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

Re: [pygame] Re: pygame + pyopengl



> Hoorah, gl_swap_buffers Works For Me.
> I think pygame.display.update() should work too, but strangely enough,
> it segfaults.  A backtrace shows that it's dying in
> SDL_video.c:SDL_UpdateRects(), because current_video is NULL!  Except this
> is set in SDL_VideoInit, and if it wasn't set at all, not much else in
> SDL would be working...
> 
> Also, occasionally when running Francis's test program (but not always),
> it wouldn't work.  Then I'd kill it and run it again, and it would.
> 
> These sorts of things have got me wondering -- are there thread safety
> issues I'm not taking into account?

i'm not sure its a thing of thread safety, as much as in SDL
once you create an opengl display, you're not really supposed
to use any of the SDL display functions. i'll definitely make
the pygame.display.flip() function "do the right thing." i'm
not sure if changing pygame.display.update() is goot also, 
i'll think about it more.

what i'll need to do is go through all the pygame video functions
and have them raise an exception if they are not supposed to be
called on opengl displays. unfortunately it's pretty undocumented
what can and can't be called for opengl, but the general status is
don't call them.

as far as threads go, pygame doesn't make use of any threading
itself. but SDL will internally use threads (for stuff like events
and timers). i have made the effort to keep pygame smart with the
pygame global interpreter lock, so it should be pretty thread safe,
but other than any 'user mistakes', pygame will be as thread safe
as SDL is.

for example, i've got some threaded stuff in my current game for
loading all game resources as well as downloading stuff on the
internet. in both cases there is an onscreen progress while the
game does its processing, and the game remains interactive while
it is happening.

what platform are you seeing the occasional random lock up?
perhaps you can get the debugger to find out what exactly is going
on? you can also configure SDL to compile without threads. which may
or may not make the problem go away?


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