Hello community,
I compiled osg for GL3, and created a glContextVersion( "3.3" ) GL
context. In my simple test application Camera Manipulation and
MatrixTransforms are working as usual without me writing any
transformation shader. Is this possible ?
As I have doubts about this I guess that I have setup the GL context in
a wrong way, so how does one set it up properly ?
My way:
osg::GraphicsContext::Traits * traits = new
osg::GraphicsContext::Traits() ;
int width = 1920 , height = 1200 ;
traits -> x = 0 ;
traits -> y = 0 ;
traits -> width = width ;
traits -> height = height ;
traits -> windowDecoration = true ;
traits -> doubleBuffer = true ;
traits -> glContextVersion = std::string( "3.3" ) ;
traits -> windowDecoration = false ;
osg::GraphicsContext * graphicsContext =
osg::GraphicsContext::createGraphicsContext( traits ) ;
osg::Camera * cam = new osg::Camera() ;
cam -> setGraphicsContext( graphicsContext ) ;
cam -> setViewport( 0 , 0 , width , height ) ;
cam -> setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
cam -> setClearColor( osg::Vec4( 0.0 , 0.0 , 0.0 , 1.0 ) ) ;
cam -> setProjectionMatrixAsPerspective( 30.0f , ( float )width / (
float )height , 1.0 , 1000.0 ) ;
viewer.setCamera( cam ) ;
viewer.setSceneData( xform.get() ) ;
viewer.realize() ;
return viewer.run() ;
Thank you
Cheers, PP
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org