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

2018-03-28 Thread Robert Osfield
Hi Ali,

On 28 March 2018 at 12:08, Ali Ozdin  wrote:
> I think there is a bug in osg framework related to clipNode with osgText. Is 
> there any issue tracking system that users can create a bug issue for this?

There is a chance that it's an OSG bug, but also still quite likely
something has gone astray at your end, it's hard to spot subtle errors
from looking at copy and pasted code rather than a full application
code.

The best way forward is to create an small test program that
reproduces the issue you have and the post this along with a
CMakeLists.txt to compile it easily - this will allow others to build
and run the test on their system to see if they can reproduce it.  If
we can reproduce it then we should be able either spot an error in the
test code or use this as a unit test for hunting down the bug on the
OSG side.

Information on hardware, OS and build tools used at your end are also
useful when hunting down bugs (often bugs only appear on particular
hardware/OS/build combinations.)

You could post the example here on this thread, or post it to the
Issue tracker on our github repository.

   https://github.com/openscenegraph/OpenSceneGraph/issues

Robert
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Bug in osgDB::findFileInDirectory

2018-03-28 Thread Riccardo Corsi
​Thanks Robert​

*Riccardo Corsi*  sw engineering & co-founder
*Kairos3D srl*  Via Agostino da Montefeltro 2, 10134 Torino Italy
*T* +390113157111  *M* +393288522785
*Check out our ground-breaking 3D CAD-to-VR toolchain: www.kairos3d.it
*

On Wed, Mar 28, 2018 at 12:50 PM, Robert Osfield 
wrote:

> Hi Ricardo,
>
> On 27 March 2018 at 19:42, Robert Osfield 
> wrote:
> > ./test --dir ~/OpenSceneGraph/include/osg/ --file version
> > Result with findFileInDirectory(): 0
> > Result with fileExists(): 0
> > concatenated=/home/robert/OpenSceneGraph/include/osg/version
> >
> > Which confirms your suggestion that the trailing slash isn't handled
> > by findFileInDirectory().
>
> I have checked in a catch for users passing in directories with a
> trailing / or \.  This fix is checked into OSG master and the 3.6
> branch.
>
> Robert
> ___
> 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


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

2018-03-28 Thread Ali Ozdin
Thank you Robert. Sorry for taking your time.

I think there is a bug in osg framework related to clipNode with osgText. Is 
there any issue tracking system that users can create a bug issue for this?


robertosfield wrote:
> Hi Ali.
> 
> On 28 March 2018 at 11:40, Ali Ozdin <> wrote:
> 
> > Did you examine my sample code?
> > 
> 
> I looked over you code but I have already replied to you on this.  I
> can't keep following you up on this, I have LOTS of other stuff to get
> on with than just provide you with personal free support.  I have
> tried to help, pointed you in what I think is the right direction, but
> this is all I have time for.
> 
> Robert.
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73195#73195





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Bug in osgDB::findFileInDirectory

2018-03-28 Thread Robert Osfield
Hi Ricardo,

On 27 March 2018 at 19:42, Robert Osfield  wrote:
> ./test --dir ~/OpenSceneGraph/include/osg/ --file version
> Result with findFileInDirectory(): 0
> Result with fileExists(): 0
> concatenated=/home/robert/OpenSceneGraph/include/osg/version
>
> Which confirms your suggestion that the trailing slash isn't handled
> by findFileInDirectory().

I have checked in a catch for users passing in directories with a
trailing / or \.  This fix is checked into OSG master and the 3.6
branch.

Robert
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2018-03-28 Thread Robert Osfield
Hi Ali.

On 28 March 2018 at 11:40, Ali Ozdin  wrote:
> Did you examine my sample code?

I looked over you code but I have already replied to you on this.  I
can't keep following you up on this, I have LOTS of other stuff to get
on with than just provide you with personal free support.  I have
tried to help, pointed you in what I think is the right direction, but
this is all I have time for.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2018-03-28 Thread Ali Ozdin
Hi Robert,

Did you examine my sample code? 
I dont set mode GL_CLIP_PLANEi to my subgraph in the sample. I am only using 
createClipBox function like in the osgClip example.

Do you think sample code I have sent to you seems to work right?

If the sample code I have sent to you seems right; what is your advice?






robertosfield wrote:
> Hi Ali,
> 
> When you put nodes underneath a ClipNode those nodes should inherit
> the required GL_CLIP_PLANEi, so in theory it should work right,
> however, as I've never mixed osgText with clipping I can only say I
> don't see a reason in principle when it wouldn't work.  If you put the
> subgraphs you want to clip in a different subgraph you'll need to set
> the GL_CLIP_PLANEi.
> 
> Robert.
> 
> On 28 March 2018 at 08:46, Ali Ozdin <> wrote:
> 
> > Hi Robert,
> > 
> > Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but 
> > all geometry in geodeForgeomRight works well except osgText geometries. 
> > Sample code is below:
> > 
> > 
> > Code:
> > 
> > osg::ClipNode* clipped_subgraph;
> > osg::ref_ptr geodeForgeomRight;
> > 
> > osg::ref_ptr bottomAltitudeText = new  osgText::Text;
> > osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 
> > 0.0f);
> > std::string timesFont("fonts/arial.ttf");
> > bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
> > bottomAltitudeText->setFont(timesFont);
> > bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
> > bottomAltitudeText->setPosition(position);
> > bottomAltitudeText->setText("hello world" );
> > bottomAltitudeText->setCharacterSize(15.0);
> > geodeForgeomRight->addDrawable( bottomAltitudeText.get() );
> > 
> > 
> > osg::ref_ptr mt = new osg::MatrixTransform();
> > mt->addChild(geodeForgeomRight.get());
> > 
> > clipped_subgraph = new osg::ClipNode;
> > double xMin,yMin, zMin, xMax, yMax, zMax;
> > xMin = (SCREEN_WIDTH * 0.64);
> > yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
> > zMin = 0.0f;
> > xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
> > yMax = SCREEN_HEIGHT*0.6;
> > zMax = 0.0f;
> > osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
> > clipped_subgraph->createClipBox(bb);
> > clipped_subgraph->addChild(mt);
> > 
> > clipped_subgraph->setCullingActive(true);
> > mt->setUpdateCallback(new AltitudeCallBack());
> > 
> > 
> > 
> > 
> > Best regards,
> > 
> > 
> > robertosfield wrote:
> > 
> > > Hi Ali,
> > > I haven't tested this specific combination of features, but in
> > > principle it should be just a case of enabling the GL_CLIP_PLANEi mode
> > > for the text subgraphs.
> > > 
> > > Which version of the OSG are you using and what GL versions?
> > > 
> > > The new osgText implementation in master/OSG-3.6 branch uses shaders
> > > so out of the box, looking at the shader I don't see any setting of
> > > the gl_ClipVertex so this could be a problem.  I will look into this.
> > > 
> > > Robert.
> > > ___
> > > osg-users mailing list
> > > 
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > 
> > > --
> > > Post generated by Mail2Forum
> > > 
> > 
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=73188#73188
> > 
> > 
> > 
> > 
> > 
> > ___
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73192#73192





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2018-03-28 Thread Robert Osfield
Hi Ali,

When you put nodes underneath a ClipNode those nodes should inherit
the required GL_CLIP_PLANEi, so in theory it should work right,
however, as I've never mixed osgText with clipping I can only say I
don't see a reason in principle when it wouldn't work.  If you put the
subgraphs you want to clip in a different subgraph you'll need to set
the GL_CLIP_PLANEi.

Robert.

On 28 March 2018 at 08:46, Ali Ozdin  wrote:
> Hi Robert,
>
> Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but 
> all geometry in geodeForgeomRight works well except osgText geometries. 
> Sample code is below:
>
>
> Code:
>
> osg::ClipNode* clipped_subgraph;
> osg::ref_ptr geodeForgeomRight;
>
> osg::ref_ptr bottomAltitudeText = new  osgText::Text;
> osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 
> 0.0f);
> std::string timesFont("fonts/arial.ttf");
> bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
> bottomAltitudeText->setFont(timesFont);
> bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
> bottomAltitudeText->setPosition(position);
> bottomAltitudeText->setText("hello world" );
> bottomAltitudeText->setCharacterSize(15.0);
> geodeForgeomRight->addDrawable( bottomAltitudeText.get() );
>
>
> osg::ref_ptr mt = new osg::MatrixTransform();
> mt->addChild(geodeForgeomRight.get());
>
> clipped_subgraph = new osg::ClipNode;
> double xMin,yMin, zMin, xMax, yMax, zMax;
> xMin = (SCREEN_WIDTH * 0.64);
> yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
> zMin = 0.0f;
> xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
> yMax = SCREEN_HEIGHT*0.6;
> zMax = 0.0f;
> osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
> clipped_subgraph->createClipBox(bb);
> clipped_subgraph->addChild(mt);
>
> clipped_subgraph->setCullingActive(true);
> mt->setUpdateCallback(new AltitudeCallBack());
>
>
>
>
> Best regards,
>
>
> robertosfield wrote:
>> Hi Ali,
>> I haven't tested this specific combination of features, but in
>> principle it should be just a case of enabling the GL_CLIP_PLANEi mode
>> for the text subgraphs.
>>
>> Which version of the OSG are you using and what GL versions?
>>
>> The new osgText implementation in master/OSG-3.6 branch uses shaders
>> so out of the box, looking at the shader I don't see any setting of
>> the gl_ClipVertex so this could be a problem.  I will look into this.
>>
>> Robert.
>> ___
>> osg-users mailing list
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>  --
>> Post generated by Mail2Forum
>
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=73188#73188
>
>
>
>
>
> ___
> 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


Re: [osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

2018-03-28 Thread Robert Osfield
Hi Hartwig,

On 27 March 2018 at 17:44, Hartwig Wiesmann  wrote:
> I was not talking about the cullingActive flag but the method 
> isCullingActive! isCullingActive checks besides the cullingActive flag if the 
> boundary sphere is valid. As long as the boundary sphere is invalid 
> isCullingActive() returns false. This is the problem I reported.

This is by design, you can't cull something that doesn't have a valid
bounding volume as culling tests are based on the bounding volume.

For AutoTransform the bounding volume change per frame, especially so
if it's being scaled to screen space as it's size can grow and shrink,
so in this case leaving it undefined is the one safe thing to do.

As for children of an AutoTransform not being culled, this is
incorrect, the children's culling will be done in their own right,
what happens to the parents will no affect this.

As a general note, AutoTransform is not something I would recommend
using for large numbers of objects in your scene as it not only
presents issues with cullng itself but also forces the cull traversal
to transform the view frustum into the children coordinate frame, this
involves pushing/popping view frustum state on and off a stack as
well.

I don't know the specifics of your scene graph or the particular
performance issues you are trying to address, but it may well be that
pushing the task of rotating/scaling to a vertex or geometry shader
might be the best way to refactor your scene graph for best
performance.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Conflict between osg-3.0.1 and UI

2018-03-28 Thread Eran Cohen
Hi,

We have a program with a UI that is built in WPF and  WinForms and runs on 
Windows 7.
We have another library that uses OSG-3.0.1  that we are trying to integrate 
into our program. This library uses OSG to render a picture to the screen 
(using osgViewer).

Our program can run either from the UI or from the command line without the UI.

When we try to use the library in our program while using the UI, we get the 
following error:

> Warning: Windows Error #170 : [Screen 0]
> GraphicsWindowWin32::makeCurrentImplementation() - Unable to set current 
> OpenGL rendering context.
> Reason: The requested resource is in use.

and we get a black picture rendered to the screen.
But if we run it from the command line without the UI everything works as 
expected.

We have tried finding packages in our UI that use OSG, but we haven't found 
any. 
If anyone has encountered a similar situation before or has any idea in what 
direction we should look to solve this problem, it would be greatly appreciated.

Thank you!

Cheers,
Eran[/quote]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73189#73189





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2018-03-28 Thread Ali Ozdin
Hi Robert,

Firstly, I am using osg 3.4.1. However I dont enable any GL_CLIP_PLANEi but all 
geometry in geodeForgeomRight works well except osgText geometries. Sample code 
is below:


Code:

osg::ClipNode* clipped_subgraph;
osg::ref_ptr geodeForgeomRight;

osg::ref_ptr bottomAltitudeText = new  osgText::Text;
osg::Vec3 position( (SCREEN_WIDTH * 0.64) + bigLineLength, (i/2)*lineBreak, 
0.0f);
std::string timesFont("fonts/arial.ttf");
bottomAltitudeText->setAlignment(osgText::TextBase::AlignmentType::LEFT_CENTER);
bottomAltitudeText->setFont(timesFont);
bottomAltitudeText->setColor( osg::Vec4f(0.f, 255.f,0.f,1.f) );
bottomAltitudeText->setPosition(position);
bottomAltitudeText->setText("hello world" );
bottomAltitudeText->setCharacterSize(15.0);
geodeForgeomRight->addDrawable( bottomAltitudeText.get() );


osg::ref_ptr mt = new osg::MatrixTransform(); 
mt->addChild(geodeForgeomRight.get());

clipped_subgraph = new osg::ClipNode;
double xMin,yMin, zMin, xMax, yMax, zMax;
xMin = (SCREEN_WIDTH * 0.64);
yMin = SCREEN_HEIGHT*0.6 - 17*lineBreak;
zMin = 0.0f;
xMax = geodeForgeomRight.get()->getBoundingBox().xMax();
yMax = SCREEN_HEIGHT*0.6;
zMax = 0.0f;
osg::BoundingBox bb(xMin,yMin, zMin, xMax, yMax, zMax);
clipped_subgraph->createClipBox(bb);
clipped_subgraph->addChild(mt);

clipped_subgraph->setCullingActive(true);
mt->setUpdateCallback(new AltitudeCallBack());




Best regards, 


robertosfield wrote:
> Hi Ali,
> I haven't tested this specific combination of features, but in
> principle it should be just a case of enabling the GL_CLIP_PLANEi mode
> for the text subgraphs.
> 
> Which version of the OSG are you using and what GL versions?
> 
> The new osgText implementation in master/OSG-3.6 branch uses shaders
> so out of the box, looking at the shader I don't see any setting of
> the gl_ClipVertex so this could be a problem.  I will look into this.
> 
> Robert.
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73188#73188





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org