Sorry for the long delay on replying, but I was busy with paid client work.
I've developed a small test program that opens a GL 3.1 context. Set
OSG_NOTIFY_LEVEL=DEBUG to see console messages during execution to confirm this.
I'm not sure why the OP was not seeing createContextImplementation() get called,
as I see no way for the code to avoid this; perhaps he did not build OSG
correctly? Or maybe my code, below, will help him track down the problem.
Currently, the code below just renders a blank window with a deep red clear
color. Nothing gets rendered, as there are no shaders. As time allows, I'll add
basic shaders to render the command line model, and also post my cheat sheet for
configuring CMake to build OSG as GL3-compatible.
Hope this helps.
-Paul
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osg/GraphicsContext>
#include <osg/Camera>
#include <osg/Viewport>
int main( int argc, char** argv )
{
osg::ArgumentParser arguments( &argc, argv );
osgViewer::Viewer viewer;
viewer.setSceneData( osgDB::readNodeFiles( arguments ) );
osg::ref_ptr< osg::GraphicsContext::Traits > traits = new
osg::GraphicsContext::Traits();
traits->x = 20;
traits->y = 30;
traits->width = 800;
traits->height = 450;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->glContextVersion = "3.1";
osg::ref_ptr< osg::GraphicsContext > gc =
osg::GraphicsContext::createGraphicsContext( traits.get() );
if( !gc.valid() )
return( 1 );
osg::Camera* cam = new osg::Camera;
cam->setGraphicsContext( gc.get() );
cam->setViewport( new osg::Viewport( 0, 0, 800, 450 ) );
cam->setClearColor( osg::Vec4( .4, 0., 0., 1. ) );
viewer.setCamera( cam );
return( viewer.run() );
}
On 10/12/2011 6:16 AM, PP CG wrote:
O.K. in any case, thank you for your time Paul.
@Community, I wonder if this behavior should be treated as bug and should be
reported. What else could be done to find the source of the problem ?
Summary: My GL3 compiled osg version does not reach the code where a forward
compatible GL3 context gets created. What should be my next steps ?
Meanwhile I recompiled for GL3 following this article, and made sure QT does
not get build:
http://forum.openscenegraph.org/viewtopic.php?t=7322
Cheers, PP
You are on Windows, right? And I assume you built OSG for GL3 (changed all
the CMake setting from their default GL2 values)?
-Paul
On 10/11/2011 10:25 AM, PP CG wrote:
Hi Paul,
thanks, but unfortunately this does not help as the method
GraphicsWindowWin32::createContextImplementation() does not get called at
all, and the glContextVersion does not get parsed ( at my site ). This
brings me back to my doubts and original question, probably I use the wrong
way to create the GL3 context, so what is the right way ?
I am sorry, I am getting lost in the osg code here. Have no idea what to do
to get this particular method called.
Thank you
Cheers, PP
Hi -- A simple search of the source code shows that glContextVersion is
parsed in only one place: GraphicsContextWin32.cpp, line 1678. Set a
breakpoint there in the debugger and step through the following lines of
code to ensure you're getting the right context.
-Paul
On 10/11/2011 1:32 AM, PP CG wrote:
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org