From Thibault Genessay, "You'll find attached a fix for the comments of the osgwindows example. It fixes a typo in the comments which is quite disturbing for newbies trying to learn using the source (twice 'left' instead of 'left' and 'right').
I've also added a little offset to the windows' positions so that their decoration falls inside the desktop and we can manipulate them - it looks a bit less "made out of wood"."
This commit is contained in:
parent
7f0b3144ea
commit
afc722d43b
@ -44,12 +44,15 @@ int main( int argc, char **argv )
|
|||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
|
int xoffset = 40;
|
||||||
|
int yoffset = 40;
|
||||||
|
|
||||||
// left window + left slave camera
|
// left window + left slave camera
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||||
traits->x = 0;
|
traits->x = xoffset + 0;
|
||||||
traits->y = 0;
|
traits->y = yoffset + 0;
|
||||||
traits->width = 640;
|
traits->width = 600;
|
||||||
traits->height = 480;
|
traits->height = 480;
|
||||||
traits->windowDecoration = true;
|
traits->windowDecoration = true;
|
||||||
traits->doubleBuffer = true;
|
traits->doubleBuffer = true;
|
||||||
@ -64,16 +67,16 @@ int main( int argc, char **argv )
|
|||||||
camera->setDrawBuffer(buffer);
|
camera->setDrawBuffer(buffer);
|
||||||
camera->setReadBuffer(buffer);
|
camera->setReadBuffer(buffer);
|
||||||
|
|
||||||
// add this slave camra to the viewer, with a shift left of the projection matrix
|
// add this slave camera to the viewer, with a shift left of the projection matrix
|
||||||
viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd());
|
viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd());
|
||||||
}
|
}
|
||||||
|
|
||||||
// left window + left slave camera
|
// right window + right slave camera
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||||
traits->x = 640;
|
traits->x = xoffset + 600;
|
||||||
traits->y = 0;
|
traits->y = yoffset + 0;
|
||||||
traits->width = 640;
|
traits->width = 600;
|
||||||
traits->height = 480;
|
traits->height = 480;
|
||||||
traits->windowDecoration = true;
|
traits->windowDecoration = true;
|
||||||
traits->doubleBuffer = true;
|
traits->doubleBuffer = true;
|
||||||
@ -88,7 +91,7 @@ int main( int argc, char **argv )
|
|||||||
camera->setDrawBuffer(buffer);
|
camera->setDrawBuffer(buffer);
|
||||||
camera->setReadBuffer(buffer);
|
camera->setReadBuffer(buffer);
|
||||||
|
|
||||||
// add this slave camra to the viewer, with a shift right of the projection matrix
|
// add this slave camera to the viewer, with a shift right of the projection matrix
|
||||||
viewer.addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd());
|
viewer.addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user