[gameprogrammer] Re: rendering video using OpenGL and SDL

  • From: Scott Harper <lareon@xxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Tue, 15 May 2007 21:24:09 -0600


On 2007/05/15, at 14:22, Husam Zakaria wrote:

Dear Scott Harper you wrote :

>So, when written as is, the movie is NOT rendered when it should be,
>but if you comment out the code to render the game without the movie,
>then the movie IS rendered...?

but I didn't say that!, you should focus very well in my mail, I said that the movie is rendered very well when I comment out the code that render the current frame of the game.
In this case, I have no idea what you meant by "the current frame of the game". So what I read made very little sense to me, and I apologize for guessing.
however, I have solved the problem by using glDrawPixels function to render the SDL surface that have the frame from the movie, that will solve the problem if I want to render the movie in fullscreen mode, but when I render the surface to an OpenGL texture and then render the texture to a face from a cube for an example, it will be very slow because I have to create the texture every frame and copy the pixels from the movie surface to the texture to render it as a OpenGL texture and delete it every frame, any one would tell me how I can do it without creating the texture every frame and destroying it every frame in OpenGL.
I seem to recall that glDrawPixels isn't necessarily going to be a good way to draw ANYTHING of any size, as on most cards it becomes ridiculously slow when calling the function enough to show most anything useful.

However, for uploading video frame data to a texture, then Mr. de Groot's response is your best bet, and you should use glTexSubImage2D (). I use that in my own SDL/Video playback application, and the most limiting factor I've run into is decoding the video and converting from YUV to RGB, not uploading pixel data.

-- Scott



---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: