Fixed osgsimplegl3 example's set up of the main camera.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14524 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-11-24 14:09:14 +00:00
parent fce7137525
commit 2a8d894168

View File

@ -90,16 +90,16 @@ int main( int argc, char** argv )
return( 1 );
}
osgViewer::Viewer viewer;
// Create a Camera that uses the above OpenGL context.
osg::Camera* cam = new osg::Camera;
osg::Camera* cam = viewer.getCamera();
cam->setGraphicsContext( gc.get() );
// Must set perspective projection for fovy and aspect.
cam->setProjectionMatrix( osg::Matrix::perspective( 30., (double)width/(double)height, 1., 100. ) );
// Unlike OpenGL, OSG viewport does *not* default to window dimensions.
cam->setViewport( new osg::Viewport( 0, 0, width, height ) );
osgViewer::Viewer viewer;
viewer.setCamera( cam );
viewer.setSceneData( root );
// for non GL3/GL4 and non GLES2 platforms we need enable the osg_ uniforms that the shaders will use,