[osg-users] Show part of geometry which intersects a specific area

Daniel Emminizer, Code 5773 dan.emminizer at nrl.navy.mil
Mon Apr 2 06:58:57 PDT 2018


Hi Robert,

This morning I tried the OSG 3.6.0-rc3 tag and started getting errors.  I tracked down the problem to the commit you reference in this email below:

https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

Specifically the shader lines:

#ifndef GL_ES
    gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
#endif


We're trying to target the graphics cards that are supporting OpenGL Core profile, but not a compatibility profile.  When I run anything with text, I get awkward quads on the screen with various colors because this shader no longer compiles on the card.  It was working with the 3.6.0-rc2.

My general configuration is configuring OSG with OPENGL_PROFILE="GLCORE", then running with environment variable "OSG_GL_CONTEXT_VERSION=3.3".

Unfortunately I do not have any suggestions on what to do in this case; I do not know offhand if there is a #ifdef that you can natively use to test, but I can say that GL_ES is not defined in this configuration.  But I hope this email is helpful at least for testing the RC3 tag.  If you have any ideas I'm happy to test out on my side.

Thanks,

 - Dan


-----Original Message-----
From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: Friday, March 30, 2018 11:21 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Show part of geometry which intersects a specific area

Hi Ali,

I had some time for looking into bugs this afternoon so I have modified the osgclip example to allow one to pass in a osgText::Text as the subgraph for clipping and this confirmed that clipping isn't working for osgText::Text in the 3.4 branch.

  osgclip --text MY_TEST

Is sufficient to run the new test.  You'll need update to 3.4 banch,
3.6 branch or master to get this example.  The commit that provides the new test code is:

      https://github.com/openscenegraph/OpenSceneGraph/commit/ddce3e0079e934bce13fd5350d9380a19ec15de2

I have done a review of the osgText::Text implementation in the 3.4 branch and can't see any where when clipping is explicitly disabled so I'm surprised it's not functioning OK.  Unfortunately I couldn't spot any good lead to investigate, I can only guess that there is some interaction with the way the the old osgText 3.4 code renders text using a multi-pass approach where is toggles on/off the color mask and depth writes.  Without an obvious reason for failure I can't see a way of resolving the problem for the 3.4 branch.

The test also failed with OSG master and the new OpenScenGraph-3.6 branch, but this was easy to fix as osgText implementation has been almost completely rewritten since 3.4, and now uses shaders.  The fix was simply the add setting of the gl_ClipVertex into the shader and then the everything works fine.  The new osgText implementation doesn't implement using lots of toggling of state or is saddled with multi-pass approach so is cleaner, as well as provides better visual quality and some new approaches such as using Signed Distance Function (you need to enable this on osgText::Font to use it.)

The fix to the OpenSceneGraph-3.6 branch is:

    https://github.com/openscenegraph/OpenSceneGraph/commit/9d5a22a0aa88125c3d41fc05bff72ae188b1a00b

I also updated the OpenSceneGraph-Data as this contains the shaders/text.vert this is embedded in the source of the osgText library - which the above commit modifies.

As the OpenSceneGrpah-3.6.0 stable release is imminent, I would suggest just moving to the 3.6 branch or the release candidate 3 branch I'll be making this afternoon, as this should resolve the problem you are seeing.

Cheers,
Robert.
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list