[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] pygame/pyopengl and mpeg
I've never done this myself, but I'm pretty sure it's possible given
that I've used scenegraph engines where it was done. Basically, what
you wind up doing is creating 3 things:
a lock. Your decoder renders into the buffer with the lock aquired,
then releases the lock. The scenegraph engine acquires the lock before
rendering any geometry with the texture.
a memory buffer into which the mpeg decoder writes its results (in
OpenGL-friendly format)
an OpenGL "texture" which is pointing to the buffer above with the
proper format values. If I'm correct, the "texture" is actually just a
matter of pointing the texture functions at the beginning of the buffer
with all the values set for the format and size. There's not much point
creating a new OpenGL Texture (that is, a real texture stored in card
memory) each time the frame changes, better to just use the AGP bus to
transfer the changed image each time.
If you don't care about performance, of course, you could just capture
the current frame of the movie to a string, create a texture from that,
and then render the current scene. This would be a dog on a hot August
day, though :) .
BTW, there's a NeHe tutorial using AVI in OpenGL, you can probably pick
up a lot from that, it does actually create captures of the movie's
current frame (or blit into an existing texture from the current frame):
http://nehe.gamedev.net/tutorials/lesson.asp?l=35
Good luck, and let us know what you decide to do,
Mike
Pete Shinners wrote:
> urmas eero wrote:
>
>>Is possible to play mpeg movies with pygame on opengl surface ?
>
>
> hmm, i don't expect you can display mpeg movies directly on an opengl
> display. your only hope would be to output the mpeg movie to an offscreen
> surface, then convert the surface to a texture.
>
> for realtime playback, that likely won't be fast enough for 30fps video. if
> the movie is short enough, you could prerender each frame of the movie into
> a texture, but beware users without much texture memory.
>
> unfortunately this type of thing really requires some sort of platform
> dependant movie decoding, and i don't believe SDL has any support for this.
> i guess the "try it and see" approach will be best. do share any results
> you can get.
>
>
>
>
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org
>
--
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org