Added option for doing triple buffering, and set the default read format

to GL_RGBA
This commit is contained in:
Robert Osfield
2008-05-26 11:53:51 +00:00
parent dc7db11e63
commit d2afe3e956

View File

@@ -40,7 +40,8 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
{
READ_PIXELS,
SINGLE_PBO,
DOUBLE_PBO
DOUBLE_PBO,
TRIPLE_PBO
};
enum FramePosition
@@ -57,7 +58,7 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
_mode(mode),
_readBuffer(readBuffer),
_fileName(name),
_pixelFormat(GL_BGR),
_pixelFormat(GL_BGRA),
_type(GL_UNSIGNED_BYTE),
_width(0),
_height(0),
@@ -86,6 +87,12 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
_pboBuffer.push_back(0);
_pboBuffer.push_back(0);
break;
case(TRIPLE_PBO):
osg::notify(osg::NOTICE)<<"Reading window usig glReadPixels, with a double buffer PixelBufferObject."<<std::endl;
_pboBuffer.push_back(0);
_pboBuffer.push_back(0);
_pboBuffer.push_back(0);
break;
default:
break;
}
@@ -574,6 +581,7 @@ int main(int argc, char** argv)
while (arguments.read("--no-pbo")) mode = WindowCaptureCallback::READ_PIXELS;
while (arguments.read("--single-pbo")) mode = WindowCaptureCallback::SINGLE_PBO;
while (arguments.read("--double-pbo")) mode = WindowCaptureCallback::DOUBLE_PBO;
while (arguments.read("--triple-pbo")) mode = WindowCaptureCallback::TRIPLE_PBO;