<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="text-align:left; direction:ltr;">
<div>Hi Robert,</div>
<div><br>
</div>
<div>Thanks for the comprehensive reply, I think I've done what you suggested but it doesn't appear to have changed anything.</div>
<div><br>
</div>
<div>This application uses osggtkdrawingarea which I've modified to work with GtkGLArea.</div>
<div><br>
</div>
<div>The viewer is added like so:</div>
<div><br>
</div>
<div>class OSGGTKDrawingArea : public osgViewer::Viewer {</div>
<div></div>
<div>osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> _gw;</div>
<div><br>
</div>
<div>...</div>
<div>}</div>
<div><br>
</div>
<div>_gw = setUpViewerAsEmbeddedInWindow(0, 0, width, height);</div>
<div><br>
</div>
<div>and in the realise callback I've added this:</div>
<div><br>
</div>
<div>getCamera()->setGraphicsContext(_gw);</div>
<div> getCamera()->getOrCreateStateSet()->setGlobalDefaults();</div>
<div><br>
</div>
<div>I even tried explicitly setting depth test</div>
<div><br>
</div>
<div>getCamera()->getOrCreateStateSet()->setMode( GL_DEPTH_TEST, osg::StateAttribute::ON );</div>
<div><br>
</div>
<div>Still no joy.</div>
<div><br>
</div>
<div>I turned on GL_CULL_FACE just to check and it did what I expected so setting the camera attributes appears to be working.</div>
<div><br>
</div>
<div>Anything else you can think of tat I can try?</div>
<div><br>
</div>
<div>Cheers,</div>
<div></div>
<div><br>
</div>
<div><br>
</div>
<div>On Mon, 2020-09-07 at 09:12 +0100, OpenSceneGraph Users wrote:</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div dir="ltr">
<div dir="ltr">Hi Franco,<br>
</div>
<div><br>
</div>
<div>Posting screenshots is fine, and exactly the thing to do with these types of problems.<br>
</div>
<div><br>
</div>
<div class="gmail_quote">It's not possible to diagnose the exact problem you are seeing with rendering under OSG-3.6.5. Broadly it looks like a depth test issue.</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">I don't know if this is relevant, but will mention it as some others have been caught out by it. One of the bug fixes in the OSG-3.x series was to fix an override of the osg::Camera settings that was causing applications settings to
be lost. The fix had the side effect of revealing missing settings, in essence it was a bug A that hide a bug B that only occurred with certain usage models.
<br>
</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">So bug A has been fixed and bug B usage case is an application creates a viewer osg::Camera, sets up a graphics context, then just directly assigns it to the viewer without setting any global state that is required for top level osg::Camera.
The state not set includes GL_DEPTH_TEST - which is where there "might"<span class="gmail-pl-k"> be an overlap with the problem you see with your application.</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"><br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k">Normal OSG usage where you use the Viewer Camera's that are assigned by default also call
<span class="gmail-pl-en">StateSet::setGlobalDefaults</span>() on this StateSet, so you never see a problem. All the OSG examples provided in the OpenSceneGraph distribution do this.
<br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"><br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k">However, the problem usage cause was something that was done in early osgQt based examples - they created a local osg::Camera assigned to the viewer and never called StateSet::setGlobalDefaults() on the osg::Camera's
StateSet. These examples used to work fine, even with this ill defined state because of Bug A. If you copied one of these examples then you'll inherit this bug B usage case.</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"><br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k">If this is the case then can either:</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"> <br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"> 1) Just use the viewer(views) Camera via Viewer/View::getCamera() to get the Camera to assign the GraphicsContext to, so utilize the default settings.</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"> 2) Call: camera->getOrCreateStateSet()->setGlobalDefaults() on the locally created Camera before it's assigned to the View(er).<br>
</span></div>
<div class="gmail_quote"><span class="gmail-pl-k"><br>
</span></div>
<div>There was a lot of discussion about this problem usage case and the solution when bug A was fixed and bug B revealed, but that's quite a few years ago now - had your software been updated more regularly it's likely you'll have seen discussions.</div>
<div><br>
</div>
<div>Cheers,<br>
</div>
<div>Robert.<br>
</div>
</div>
<pre>_______________________________________________</pre>
<pre>osg-users mailing list</pre>
<pre><a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a></pre>
<pre><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a></pre>
<pre><br></pre>
</blockquote>
</body>
</html>