Hi Robert,
Thank you for your answer.
I've tried and set the sharedContext member to 0 for all views,
as you've suggested.
The result was the same, corrupted polygons in one or more views.
But now with the difference that shaders work only in one view, which
is the one first created.
Maybe there is still an error in initializing the views, so I've added
the code used for creating a view:
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowWin32::WindowData(hwnd,false);
CRect winRect;
::GetClientRect(hwnd,&winRect);
// init graphics traits
traits->x = 0;
traits->y = 0;
traits->width = winRect.Width();
traits->height = winRect.Height();
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->inheritedWindowData = windata;
traits->supportsResize = true;
traits->useMultiThreadedOpenGLEngine = true;
traits->alpha = 8;
traits->red = 8;
traits->green = 8;
traits->blue = 8;
traits->depth = 24;
traits->stencil = 8;
osg::ref_ptr<osg::GraphicsContext> gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
osgViewer::View *posgViewNew = new osgViewer::View;
osg::DisplaySettings *posgDs = new osg::DisplaySettings;
posgDs->setDefaults();
posgDs->setDisplayType(osg::DisplaySettings::MONITOR);
posgDs->setDepthBuffer(true);
posgDs->setStereo(false);
posgDs->setDoubleBuffer(true);
// and make that camera display its contents in this context
posgViewNew->getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT |
GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
posgViewNew->getCamera()->setClearStencil(0);
posgViewNew->getCamera()->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);
posgViewNew->getCamera()->setDisplaySettings(posgDs);
posgViewNew->getCamera()->setGraphicsContext(gc.get());
posgViewNew->getCamera()->setViewport(0,0, winRect.Width(),
winRect.Height());
On start our application creates 4 views this way, right after creating and
setting up the
composite viewer as single threaded.
What puzzles me is that assigned shaders work only in one view and that other
views
have still corrupted polygons.
Besides displaying the views (i.e. adding them to the composite viewer) take a
long time on NVS cards.
Do you have seen such behavior?
We observed this on an NVS4200M and on other NVS systems. Are the drivers so
bad, that only one context
is supported on NVS cards?
Sadly, the other approach, you've suggested, by using the view's viewports in
the same window is for several
reason unapplicable.
Regards,
Carsten.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Robert Osfield
Sent: Monday, August 27, 2012 3:57 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Weird polygons on nVidia NVS cards
Hi Carsten,
On 27 August 2012 11:57, Carsten Scharfe <[email protected]> wrote:
> Both views share the same context. This context is created first, with no
> inherited window data.
>
> When I create a new view, I create a new context for this view and set the
> sharedContext member
>
> to the shared context. I set the inherited window data too for embedding the
> view in the desired window.
I think you are a little confused by what is a context and what is a
shared context. You description implies that you have two graphics
context, the second graphics context sharing OpenGL objects with the
first context (this is what a shared context means), but is still a
separate graphics context.
It could be that there is an issue with the viewer setup, but equally
is could be an issue in the OpenGL driver with sharing GL objects
between contexts.
Personally I would avoid sharing contexts historically has been be
problematic with some drivers, and brings up limitations in the way
that you can use the OSG i.e. you can't use it multi-threaded and you
have to be careful about cleanup. The OSG can handle multiple
contexts just fine, just don't set the sharedContext info when setting
up your new context. Alternatively just share the same graphics
context with both view's viewports on the same window - this approach
will lead to the best performance.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org