http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



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

[gameprogrammer] Re: rendering video using OpenGL and SDL




On 16 May 2007, at 5:24 AM, Scott Harper wrote:

Never use glDrawPixels, each time you call this, it will upload the data from CPU to GPU and do a lot of things you don't want, which require sync and all. It is a slow path, it can be horrible on some GPU.

The best bet is to prepare a couple of textures in GPU memory with 0 in them, then use glTexSubImage2D when you need to upload new data.

In our in game movie player, we draw a quad at each frame, with texture+textureIndex where i goes from 0 to textureCount, and we let the render function go at the speed it wants, then in an other thread, we upload a new texture every 1/30 sec and change textureIndex. Don't forget to block opengl, as it is not thread safe. If we use multiple texture, it is only because we are streaming from the filesystem, and if the buffer under run, we simply increment textureIndex to keep smooth animation while we load the rest.

Regards

--
Kuon

"Don't press that button."
http://goyman.com/



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