[gameprogrammer] rendering video using OpenGL and SDL

Hi every one, I was working on rendering video file in my game with smpeg
library, I'm using OpenGL and SDL, the problem is when I'm using SDL only
every thing is ok, and I can render the video file to the screen very fine,
because smpeg library take an SDL_Surface to render the video into, so I can
blit it to the main screen every frame, but when I'm using OpenGL, I cannot
use blitting operations in this case, so I have to render the movie surface
into a texture and then I render it to the screen using the OpenGL rendering
commands, so far until now every thing is fine, I can do it like that, but
the problem is when I want to render the video to the screen I must stop
rendering the game ( the movie is full screen ) and I have to render the
movie like that :

in the main loop :

for ( ; ;)
{
    // getting input here or what ever . . .
    //
    //

    if ( movie.isPlaying( ) == true)
    {
        // render the movie here
        movie.renderCurrentFrame( );
    }
    else
    {
        renderTheFrameFromTheGame( );
    }
}

when the game start, the game is rendered very fine, but when the movie is
start playing, the movie is not rendered ? ? ! ! !
and if I comment the: renderTheFrameFromTheGame( ); line the movie is
rendered as well ? ? ? ! !

I doubt at first in the projection matrix and the view matrix  in these two
functions, but I see that all is fine and it's not about matrices or
something in the view, I think maybe the OpenGL buffer is locked for some
reason when I want to render the movie surface to the openGL buffer, so any
one can help me with this ?

Husam Zakaria

Other related posts: