[osg-users] osgscreencapture to videobuffer async

Ralf Stokholm alfmail1 at arenalogic.com
Thu Sep 25 06:57:14 PDT 2008

Hi All

In our application we have added the option of capturing video from our
playback stream. It works fine but performance is problematic. We are
currently using a simple glReadPixels call to get the immage from the
videocard, this takes around 5-6 ms in addition we append the immage to an
AVI video stream this takes another 12 ms. It should be possible to put the
12 in another thread, but I was vondering if it would be possible to do the
same with part of the glReadPixels call using PBO's.

This is what I have in mind:

>From the Draw thread on initialrendercallback I would:

glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, read_pbo)
glReadPixels() //ASYNC
SignalVideoThread() //Async

and the in the video recorder thread when signaled

glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, copy_pbo);
GLubyte* src = (GLubyte*)ext->glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB,

Can someone tell me if this is feasable?, I was thinking that it would be
problematic to do the gl calls from another thread? or should I use a
compleately different approach?

This is run on windowsXP, Core2 quad, Nvidia GX280


Ralf Stokholm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080925/9dc93ea8/attachment-0002.htm>

More information about the osg-users mailing list