From 2a8d894168e8dcfeeee5305a15436bec37bb719b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Nov 2014 14:09:14 +0000 Subject: [PATCH] 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 --- examples/osgsimplegl3/osgsimplegl3.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/osgsimplegl3/osgsimplegl3.cpp b/examples/osgsimplegl3/osgsimplegl3.cpp index bc061e69e..3d7bee95e 100644 --- a/examples/osgsimplegl3/osgsimplegl3.cpp +++ b/examples/osgsimplegl3/osgsimplegl3.cpp @@ -20,7 +20,7 @@ void configureShaders( osg::StateSet* stateSet ) { - const std::string vertexSource = + const std::string vertexSource = "#version 140 \n" " \n" "uniform mat4 osg_ModelViewProjectionMatrix; \n" @@ -41,7 +41,7 @@ void configureShaders( osg::StateSet* stateSet ) "} \n"; osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, vertexSource ); - const std::string fragmentSource = + const std::string fragmentSource = "#version 140 \n" " \n" "in vec4 color; \n" @@ -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,