<div>    const int width( 800 ), height( 450 );</div><div>    const std::string version( "3.0" );</div><div>    osg::ref_ptr< osg::GraphicsContext::Traits > traits = new osg::GraphicsContext::Traits();</div><div>    traits->x = 20; traits->y = 30;</div><div>    traits->width = width; traits->height = height;</div><div>    traits->windowDecoration = true;</div><div>    traits->doubleBuffer = true;</div><div>    traits->glContextVersion = version;</div><div>    traits->readDISPLAY();</div><div>    traits->setUndefinedScreenDetailsToDefaultScreen();</div><div>    osg::ref_ptr< osg::GraphicsContext > gc = osg::GraphicsContext::createGraphicsContext( traits.get() );</div><div>    if( !gc.valid() )</div><div>    {</div><div>        osg::notify( osg::FATAL ) << "Unable to create OpenGL v" << version << " context." << std::endl;</div><div>        return( 1 );</div><div>    }</div><div><br></div><div>    osgViewer::Viewer viewer;</div><div><br></div><div>    // Create a Camera that uses the above OpenGL context.</div><div>    osg::Camera* cam = viewer.getCamera();</div><div>    cam->setGraphicsContext( gc.get() );</div><div>    // Must set perspective projection for fovy and aspect.</div><div>    cam->setProjectionMatrix( osg::Matrix::perspective( 30., (double)width/(double)height, 1., 100. ) );</div><div>    // Unlike OpenGL, OSG viewport does *not* default to window dimensions.</div><div>    cam->setViewport( new osg::Viewport( 0, 0, width, height ) );</div><div><br></div><div>    viewer.setSceneData( root );</div><div><br></div><div>    // for non GL3/GL4 and non GLES2 platforms we need enable the osg_ uniforms that the shaders will use,</div><div>    // you don't need thse two lines on GL3/GL4 and GLES2 specific builds as these will be enable by default.</div><div>    gc->getState()->setUseModelViewAndProjectionUniforms(true);</div><div>    gc->getState()->setUseVertexAttributeAliasing(true);</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/65ae7587-64a9-4278-8e79-f6b34a3380a5n%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/65ae7587-64a9-4278-8e79-f6b34a3380a5n%40googlegroups.com</a>.<br />