[osg-users] FixedFunctionTechnique, lighting, and createNormalMapTexture

2016-05-23 Thread Alex Taylor
Hey all,

>From previous posts, I understand clearly that FixedFunctionTechnique is
the worst of the osgVolume techniques in terms of both speed and quality of
results.

However, due to some specific requirements of the application I'm trying to
build (need for clipping to a bounding box, need to insert other geometry
into scene) and limitations in the osgViewer in my environment (no support
for pre-cameras), FixedFunctionTechnique may be something I have to
consider.

I was wondering, I understand that createNormalMapTexture is to allow for
lighting with FixedFunctionTechnique. What does one do with the resulting
array of normal vectors once you call createNormalMapTexture? Is there an
interface somewhere to pass the normals? How would one use
createNormalMapTexture to implement lighting when using
FixedFunctionTechnique?

- Alex

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


Re: [osg-users] CullVisitor object not getting properly deleted

2016-05-23 Thread Rick Irons
Hi Robert,

The code where the static cast is failing is OSG code 
(openscenegraph\src\osgUtil\CullVisitor.cpp).  I believe it is fairly recent 
code that was added just prior to the release of 3.4.0.  Here is the OSG 3.5.1 
version of the change… 
http://trac.openscenegraph.org/projects/osg/changeset/14578#file0

Thanks,
Rick

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Monday, May 23, 2016 2:02 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] CullVisitor object not getting properly deleted

Hi Rick,
The Object that your observer is trying to dynamic_cast<> on is in the throws 
of being destructed - have a look at the stack trace, I'm not surprised this 
fails.
Try removing the use of the dynamic_cast<>, replacing it with a static_cast<>.  
As long as you don't dereference and just use it to double check other arrays 
the it things should be OK.
As a general note though, it's kind odd bit of code.  What does you 
_renderStageMap contain?  Just raw C pointers?
I suspect the code should probably be redesigned to avoid trying to do tricks 
like using an custom Observer to do house keeping.

Robert.


On 23 May 2016 at 17:45, Rick Irons 
> wrote:
Hi all,

I am encountering an issue with a CullVisitor object not being properly deleted 
in version 3.4.0.  I am encountering this issue when updating from version 
3.0.1.

The source of the problem is a failed Referenced to CullVisitor dynamic cast 
that occurs in the code below…

virtual void objectDeleted(void* object)
{
osg::Referenced* ref = reinterpret_cast(object);
osgUtil::CullVisitor* cv = dynamic_cast(ref);
OpenThreads::ScopedLock lock(_mutex);
RenderStageMap::iterator itr = _renderStageMap.find(cv);
if (itr!=_renderStageMap.end())
{
_renderStageMap.erase(cv);
}
}

The call stack at the time of the failed cast is the following…

[cid:image001.png@01D1B505.D7E68DD0]

The cv pointer is NULL following the cast.  My suspicion is that the dynamic 
cast is failing because we are in the destructor of our own object that 
inherits the OSG CullVisitor object.  I tested this suspicion by confirming 
that the same dynamic cast will succeed in application code if done immediately 
before invoking the destructor of our version of the CullVisitor.  This issue 
is blocking our update to 3.4.0 since it causes numerous unit test failures.

Any suggestions on how to address this issue?

I created the hack below to temporary bypass the problem…

virtual void objectDeleted(void* object)
{
osg::Referenced* ref = reinterpret_cast(object);
osgUtil::CullVisitor* cv = dynamic_cast(ref);
OpenThreads::ScopedLock lock(_mutex);
if (cv != NULL)
{
RenderStageMap::iterator itr = _renderStageMap.find(cv);
if (itr!=_renderStageMap.end())
{
_renderStageMap.erase(cv);
}
}
else
{
   for(RenderStageMap::iterator itr = _renderStageMap.begin();
   itr != _renderStageMap.end();
   ++itr)
   {
   osg::Referenced* tmpRef = 
dynamic_cast(itr->first);
   if (ref==tmpRef)
   {
cv = itr->first;
   _renderStageMap.erase(cv);
   break;
   }
   }
}
}

Thanks,
Rick

___
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] clamp mouse cursor / position

2016-05-23 Thread Florian GOLESTIN
Hi Sebastian,

I'm not an expert, but in my case I've my own class overloading 
osgGA::StandardManipulator.
In this case, while overriding the method handleMouseMove I can call 
requestWarpPointer without recusiving call handleMouseMove.

Is it what you are looking for?

Best,
Florian

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





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


Re: [osg-users] Multiples scenes

2016-05-23 Thread Florian GOLESTIN
Hi Robert,

The player just move to a new scene so the previous one can be discarded.

By scene I wanted to mean the "root" node and all its children, and the 
callback, keeping only the view and the camera manipulator.
In the application, the player walk along a maze (an interior scene) and when 
he hits a door, he's "teleported" into another level of the maze so I load a 
new map with new walls and monsters...

Have a good day!

Florian

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





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


Re: [osg-users] CullVisitor object not getting properly deleted

2016-05-23 Thread Robert Osfield
Hi Rick,

The Object that your observer is trying to dynamic_cast<> on is in the
throws of being destructed - have a look at the stack trace, I'm not
surprised this fails.

Try removing the use of the dynamic_cast<>, replacing it with a
static_cast<>.  As long as you don't dereference and just use it to double
check other arrays the it things should be OK.

As a general note though, it's kind odd bit of code.  What does you
_renderStageMap contain?  Just raw C pointers?

I suspect the code should probably be redesigned to avoid trying to do
tricks like using an custom Observer to do house keeping.

Robert.


On 23 May 2016 at 17:45, Rick Irons  wrote:

> Hi all,
>
>
>
> I am encountering an issue with a CullVisitor object not being properly
> deleted in version 3.4.0.  I am encountering this issue when updating from
> version 3.0.1.
>
>
>
> The source of the problem is a failed Referenced to CullVisitor dynamic
> cast that occurs in the code below…
>
>
>
> virtual void objectDeleted(void* object)
>
> {
>
> osg::Referenced* ref =
> reinterpret_cast(object);
>
> osgUtil::CullVisitor* cv =
> dynamic_cast(ref);
>
> OpenThreads::ScopedLock lock(_mutex);
>
> RenderStageMap::iterator itr = _renderStageMap.find(cv);
>
> if (itr!=_renderStageMap.end())
>
> {
>
> _renderStageMap.erase(cv);
>
> }
>
> }
>
>
>
> The call stack at the time of the failed cast is the following…
>
>
>
>
>
> The cv pointer is NULL following the cast.  My suspicion is that the
> dynamic cast is failing because we are in the destructor of our own object
> that inherits the OSG CullVisitor object.  I tested this suspicion by
> confirming that the same dynamic cast will succeed in application code if
> done immediately before invoking the destructor of our version of the
> CullVisitor.  This issue is blocking our update to 3.4.0 since it causes
> numerous unit test failures.
>
>
>
> Any suggestions on how to address this issue?
>
>
>
> I created the hack below to temporary bypass the problem…
>
>
>
> virtual void objectDeleted(void* object)
>
> {
>
> osg::Referenced* ref =
> reinterpret_cast(object);
>
> osgUtil::CullVisitor* cv =
> dynamic_cast(ref);
>
> OpenThreads::ScopedLock lock(_mutex);
>
> if (cv != NULL)
>
> {
>
> RenderStageMap::iterator itr = _renderStageMap.find(cv);
>
> if (itr!=_renderStageMap.end())
>
> {
>
> _renderStageMap.erase(cv);
>
> }
>
> }
>
> else
>
> {
>
>for(RenderStageMap::iterator itr = _renderStageMap.begin();
>
>itr != _renderStageMap.end();
>
>++itr)
>
>{
>
>osg::Referenced* tmpRef =
> dynamic_cast(itr->first);
>
>if (ref==tmpRef)
>
>{
>
> cv = itr->first;
>
>_renderStageMap.erase(cv);
>
>break;
>
>}
>
>}
>
> }
>
> }
>
>
>
> Thanks,
>
> Rick
>
> ___
> 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] CullVisitor object not getting properly deleted

2016-05-23 Thread Julien Valentin
Hi
Your problem is weird, further I don't understand why you would have to create 
yourself a cullvisitor...
Give us the minimum code to reproduce the error please
(and use code section to keep indentation)


Rick Irons wrote:
> Hi all, 
> 
> I am encountering an issue with a CullVisitor object not being properly 
> deleted in version 3.4.0. I am encountering this issue when updating from 
> version 3.0.1. 
> 
> The source of the problem is a failed Referenced to CullVisitor dynamic cast 
> that occurs in the code below… 
> 
> virtual void objectDeleted(void* object) 
> { 
> osg::Referenced* ref = reinterpret_cast(object); 
> osgUtil::CullVisitor* cv = dynamic_cast(ref); 
> OpenThreads::ScopedLock lock(_mutex); 
> RenderStageMap::iterator itr = _renderStageMap.find(cv); 
> if (itr!=_renderStageMap.end()) 
> { 
> _renderStageMap.erase(cv); 
> } 
> } 
> 
> The call stack at the time of the failed cast is the following… 
> 
> 
> 
> The cv pointer is NULL following the cast. My suspicion is that the dynamic 
> cast is failing because we are in the destructor of our own object that 
> inherits the OSG CullVisitor object. I tested this suspicion by confirming 
> that the same dynamic cast will succeed in application code if done 
> immediately before invoking the destructor of our version of the CullVisitor. 
> This issue is blocking our update to 3.4.0 since it causes numerous unit test 
> failures. 
> 
> Any suggestions on how to address this issue?  
> 
> I created the hack below to temporary bypass the problem… 
> 
> virtual void objectDeleted(void* object) 
> { 
> osg::Referenced* ref = reinterpret_cast(object); 
> osgUtil::CullVisitor* cv = dynamic_cast(ref); 
> OpenThreads::ScopedLock lock(_mutex); 
> if (cv != NULL) 
> { 
> RenderStageMap::iterator itr = _renderStageMap.find(cv); 
> if (itr!=_renderStageMap.end()) 
> { 
> _renderStageMap.erase(cv); 
> } 
> } 
> else 
> { 
> for(RenderStageMap::iterator itr = _renderStageMap.begin(); 
> itr != _renderStageMap.end(); 
> ++itr) 
> { 
> osg::Referenced* tmpRef = dynamic_cast(itr->first); 
> if (ref==tmpRef) 
> { 
> cv = itr->first; 
> _renderStageMap.erase(cv); 
> break; 
> } 
> } 
> } 
> } 
> 
> Thanks, 
> Rick
> 
>  --
> Post generated by Mail2Forum


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





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


[osg-users] CullVisitor object not getting properly deleted

2016-05-23 Thread Rick Irons
Hi all,

I am encountering an issue with a CullVisitor object not being properly deleted 
in version 3.4.0.  I am encountering this issue when updating from version 
3.0.1.

The source of the problem is a failed Referenced to CullVisitor dynamic cast 
that occurs in the code below...

virtual void objectDeleted(void* object)
{
osg::Referenced* ref = reinterpret_cast(object);
osgUtil::CullVisitor* cv = dynamic_cast(ref);
OpenThreads::ScopedLock lock(_mutex);
RenderStageMap::iterator itr = _renderStageMap.find(cv);
if (itr!=_renderStageMap.end())
{
_renderStageMap.erase(cv);
}
}

The call stack at the time of the failed cast is the following...

[cid:image001.png@01D1B4EE.430210C0]

The cv pointer is NULL following the cast.  My suspicion is that the dynamic 
cast is failing because we are in the destructor of our own object that 
inherits the OSG CullVisitor object.  I tested this suspicion by confirming 
that the same dynamic cast will succeed in application code if done immediately 
before invoking the destructor of our version of the CullVisitor.  This issue 
is blocking our update to 3.4.0 since it causes numerous unit test failures.

Any suggestions on how to address this issue?

I created the hack below to temporary bypass the problem...

virtual void objectDeleted(void* object)
{
osg::Referenced* ref = reinterpret_cast(object);
osgUtil::CullVisitor* cv = dynamic_cast(ref);
OpenThreads::ScopedLock lock(_mutex);
if (cv != NULL)
{
RenderStageMap::iterator itr = _renderStageMap.find(cv);
if (itr!=_renderStageMap.end())
{
_renderStageMap.erase(cv);
}
}
else
{
   for(RenderStageMap::iterator itr = _renderStageMap.begin();
   itr != _renderStageMap.end();
   ++itr)
   {
   osg::Referenced* tmpRef = 
dynamic_cast(itr->first);
   if (ref==tmpRef)
   {
cv = itr->first;
   _renderStageMap.erase(cv);
   break;
   }
   }
}
}

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


Re: [osg-users] Setting up travis for OSG in github

2016-05-23 Thread Jordi Torres
Hey John,

Sorry for the late reply. I don't have any experience with travis and C++.
I was thinking in setting it up in my own github fork, but probably you
will do it faster than me. If you want to do it yourself let me know so we
don't duplicate efforts.

Thanks!

2016-05-20 17:02 GMT+02:00 John Hughes :

> Hi Jordi,
>
> I was actually just thinking this morning about this.
>
> Most modern software development teams these days use a continuous
> integration solution like Travis, along with an automated regression suite.
>
> I've had plenty experience maintaining both, so let me know if I can be of
> help.
>
> Cheers,
> John
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67179#67179
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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


Re: [osg-users] [Toward BufferObject serialization] Geometry serializer FinishedObjectReadCallback???

2016-05-23 Thread Julien Valentin
I surely understand that...
So Would there any test set that could ensure removal of this code doesn't 
break anything?
(I would like to submit changes I made for BufferObject and TransformFeedBack 
serialization but i'd rather lever any doubts about its integration first)


robertosfield wrote:
> On 23 May 2016 at 12:08, Julien Valentin <> wrote:
> 
> > Searching posts at this period -oct 2010- i found this post
> > http://forum.openscenegraph.org/viewtopic.php?t=6826
> > does it recall anything?
> > 
> 
> This does look relevant, I have a vague recollection, but not yet
> enough of the different threads to know what specific motivations
> were.  5 and half years and lots of topics covered in between so
> things are a little blurred :-)
> 
> 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=67208#67208





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


Re: [osg-users] [Toward BufferObject serialization] Geometry serializer FinishedObjectReadCallback???

2016-05-23 Thread Robert Osfield
On 23 May 2016 at 12:08, Julien Valentin  wrote:
> Searching posts at this period -oct 2010- i found this post
> http://forum.openscenegraph.org/viewtopic.php?t=6826
> does it recall anything?

This does look relevant, I have a vague recollection, but not yet
enough of the different threads to know what specific motivations
were.  5 and half years and lots of topics covered in between so
things are a little blurred :-)

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


Re: [osg-users] [Toward BufferObject serialization] Geometry serializer FinishedObjectReadCallback???

2016-05-23 Thread Julien Valentin
Searching posts at this period -oct 2010- i found this post 
http://forum.openscenegraph.org/viewtopic.php?t=6826
does it recall anything? 


robertosfield wrote:
> Hi Julian,
> 
> Thanks for tracking down the commit.  I did a quick search for related
> discussions on osg-users but haven't spotted anything around the right
> time frame (late October 2010).  There is probably something in
> osg-submissions and osg-users that discusses this as I don't think
> it'll be something that I would have applied without some wider issue
> discussion.
> 
> Robert.
> 
> On 23 May 2016 at 11:15, Julien Valentin <> wrote:
> 
> > Thanks Robert
> > 
> > According to the git log:
> > 
> > 
> > > commit 57a0065d08b3aa5b06da54a7b78ea2ae36cb2c9a
> > > Author: Robert OSFIELD <>
> > > Date:   Thu Oct 28 14:04:57 2010 +
> > > 
> > > Added use ObjectWrapper's FinishObjectReadCallback to fix 
> > > VertexBufferObject  handling in osg::Geometry
> > > and a call to the TileLoaded callback in osgTerrain.
> > > 
> > > 
> > > 
> > 
> > 
> > But -and perhaps I haven't investigated enough- I still don't understand 
> > what problem with VertexBufferObject it fixed...
> > 
> > 
> > 
> > robertosfield wrote:
> > 
> > > Hi Julian,
> > > 
> > > I have a vague recollection that this callback had to be used to force
> > > the VBO to be built or something along those lines.  Off the top of my
> > > head I don't recall the exact problem that instigated the change and
> > > the contributor that came up with this solution.  Perhaps git log for
> > > the files in question might help piece together why it's done.
> > > 
> > > Robert.
> > > 
> > > On 20 May 2016 at 17:35, Julien Valentin <> wrote:
> > > 
> > > 
> > > > Hi,all
> > > > I would like to provide osg TransformFeedback serialization feature but 
> > > > something weird forbid BufferObject serialization:
> > > > This callback calls setUseVertexBufferObjects(false) and just kill all 
> > > > BufferObject attached the geometry's BufferDatas
> > > > 
> > > > 
> > > > Code:
> > > > struct GeometryFinishedObjectReadCallback : public 
> > > > osgDB::FinishedObjectReadCallback
> > > > {
> > > > virtual void objectRead(osgDB::InputStream&, osg::Object& obj)
> > > > {
> > > > osg::Geometry& geometry = static_cast(obj);
> > > > if (geometry.getUseVertexBufferObjects())
> > > > {
> > > > geometry.setUseVertexBufferObjects(false);
> > > > geometry.setUseVertexBufferObjects(true);
> > > > }
> > > > }
> > > > };
> > > > 
> > > > 
> > > > I don't understand the utility of this callback (surely because I want 
> > > > to remove it:) )
> > > > Does anyone know its purpose?
> > > > 
> > > > Thank you!
> > > > 
> > > > Cheers,
> > > > Julien
> > > > 
> > > > --
> > > > Read this topic online here:
> > > > http://forum.openscenegraph.org/viewtopic.php?p=67181#67181
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > ___
> > > > 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=67204#67204
> > 
> > 
> > 
> > 
> > 
> > ___
> > 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=67206#67206





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


Re: [osg-users] [Toward BufferObject serialization] Geometry serializer FinishedObjectReadCallback???

2016-05-23 Thread Robert Osfield
Hi Julian,

Thanks for tracking down the commit.  I did a quick search for related
discussions on osg-users but haven't spotted anything around the right
time frame (late October 2010).  There is probably something in
osg-submissions and osg-users that discusses this as I don't think
it'll be something that I would have applied without some wider issue
discussion.

Robert.

On 23 May 2016 at 11:15, Julien Valentin  wrote:
> Thanks Robert
>
> According to the git log:
>
>> commit 57a0065d08b3aa5b06da54a7b78ea2ae36cb2c9a
>> Author: Robert OSFIELD <>
>> Date:   Thu Oct 28 14:04:57 2010 +
>>
>> Added use ObjectWrapper's FinishObjectReadCallback to fix 
>> VertexBufferObject  handling in osg::Geometry
>>   and a call to the TileLoaded callback in osgTerrain.
>>
>>
>
>
> But -and perhaps I haven't investigated enough- I still don't understand what 
> problem with VertexBufferObject it fixed...
>
>
>
> robertosfield wrote:
>> Hi Julian,
>>
>> I have a vague recollection that this callback had to be used to force
>> the VBO to be built or something along those lines.  Off the top of my
>> head I don't recall the exact problem that instigated the change and
>> the contributor that came up with this solution.  Perhaps git log for
>> the files in question might help piece together why it's done.
>>
>> Robert.
>>
>> On 20 May 2016 at 17:35, Julien Valentin <> wrote:
>>
>> > Hi,all
>> > I would like to provide osg TransformFeedback serialization feature but 
>> > something weird forbid BufferObject serialization:
>> > This callback calls setUseVertexBufferObjects(false) and just kill all 
>> > BufferObject attached the geometry's BufferDatas
>> >
>> >
>> > Code:
>> > struct GeometryFinishedObjectReadCallback : public 
>> > osgDB::FinishedObjectReadCallback
>> > {
>> > virtual void objectRead(osgDB::InputStream&, osg::Object& obj)
>> > {
>> > osg::Geometry& geometry = static_cast(obj);
>> > if (geometry.getUseVertexBufferObjects())
>> > {
>> > geometry.setUseVertexBufferObjects(false);
>> > geometry.setUseVertexBufferObjects(true);
>> > }
>> > }
>> > };
>> >
>> >
>> > I don't understand the utility of this callback (surely because I want to 
>> > remove it:) )
>> > Does anyone know its purpose?
>> >
>> > Thank you!
>> >
>> > Cheers,
>> > Julien
>> >
>> > --
>> > Read this topic online here:
>> > http://forum.openscenegraph.org/viewtopic.php?p=67181#67181
>> >
>> >
>> >
>> >
>> >
>> > ___
>> > 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=67204#67204
>
>
>
>
>
> ___
> 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] [Toward BufferObject serialization] Geometry serializer FinishedObjectReadCallback???

2016-05-23 Thread Julien Valentin
Thanks Robert

According to the git log:

> commit 57a0065d08b3aa5b06da54a7b78ea2ae36cb2c9a
> Author: Robert OSFIELD <>
> Date:   Thu Oct 28 14:04:57 2010 +
> 
> Added use ObjectWrapper's FinishObjectReadCallback to fix 
> VertexBufferObject  handling in osg::Geometry
>   and a call to the TileLoaded callback in osgTerrain.
> 
> 


But -and perhaps I haven't investigated enough- I still don't understand what 
problem with VertexBufferObject it fixed...



robertosfield wrote:
> Hi Julian,
> 
> I have a vague recollection that this callback had to be used to force
> the VBO to be built or something along those lines.  Off the top of my
> head I don't recall the exact problem that instigated the change and
> the contributor that came up with this solution.  Perhaps git log for
> the files in question might help piece together why it's done.
> 
> Robert.
> 
> On 20 May 2016 at 17:35, Julien Valentin <> wrote:
> 
> > Hi,all
> > I would like to provide osg TransformFeedback serialization feature but 
> > something weird forbid BufferObject serialization:
> > This callback calls setUseVertexBufferObjects(false) and just kill all 
> > BufferObject attached the geometry's BufferDatas
> > 
> > 
> > Code:
> > struct GeometryFinishedObjectReadCallback : public 
> > osgDB::FinishedObjectReadCallback
> > {
> > virtual void objectRead(osgDB::InputStream&, osg::Object& obj)
> > {
> > osg::Geometry& geometry = static_cast(obj);
> > if (geometry.getUseVertexBufferObjects())
> > {
> > geometry.setUseVertexBufferObjects(false);
> > geometry.setUseVertexBufferObjects(true);
> > }
> > }
> > };
> > 
> > 
> > I don't understand the utility of this callback (surely because I want to 
> > remove it:) )
> > Does anyone know its purpose?
> > 
> > Thank you!
> > 
> > Cheers,
> > Julien
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=67181#67181
> > 
> > 
> > 
> > 
> > 
> > ___
> > 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=67204#67204





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


Re: [osg-users] How to get Camera Heading Pitch Roll

2016-05-23 Thread Wojtek Kowalski
Hi,

Sebastian Thank you!
It works now :)


Cheers,
Wojtek

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





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


Re: [osg-users] Multiples scenes

2016-05-23 Thread Robert Osfield
Hi Florian,

I can't make a specific recommendation without knowing more about what
you mean by "scenes", whether they occupy the same coordinate space,
whether you'll want to jump between them successive, or just move to a
new scene and discard.

Could you explain more about how you want your application to behave?

Robert.

On 23 May 2016 at 06:39, Florian GOLESTIN  wrote:
> Hi everyone
>
> I'm looking for the method to go from a scene to another one.
> I've found that setting a new model scene works but is it the preferred way?
>
> Code:
>
> /* Changing the scene on the fly in a osg::NodeCallback */
> viewer.setSceneData(scene2);
>
>
>
>
>
> Thanks,
> Florian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67193#67193
>
>
>
>
>
> ___
> 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] How to get Camera Heading Pitch Roll

2016-05-23 Thread Sebastian Messerschmidt

HI,

Hi,

Thanks Sebastian,

I also tried
Code:

osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode();
csn->setEllipsoidModel(new osg::EllipsoidModel());
osg::Matrixd local_frame = csn->computeLocalCoordinateFrame(ECEFpnt);

//osg::Quat q = camera->getViewMatrix().getRotate();
osg::Matrix local_frame_inv = osg::Matrix::inverse(local_frame);
osg::Matrix q_local = local_frame_inv * camera->getViewMatrix();

Try inverting the matrix multiplication...


osg::Vec3d hpr1 = getHPRfromQuat(q_local.getRotate(););

But got wrong values :/

Define: wrong



Cheers,
Wojtek[/quote]

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





___
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] How to get Camera Heading Pitch Roll

2016-05-23 Thread Wojtek Kowalski
Hi,

Thanks Sebastian,

I also tried
Code:

osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode();
csn->setEllipsoidModel(new osg::EllipsoidModel());
osg::Matrixd local_frame = csn->computeLocalCoordinateFrame(ECEFpnt);

//osg::Quat q = camera->getViewMatrix().getRotate();
osg::Matrix local_frame_inv = osg::Matrix::inverse(local_frame);
osg::Matrix q_local = local_frame_inv * camera->getViewMatrix();

osg::Vec3d hpr1 = getHPRfromQuat(q_local.getRotate(););

But got wrong values :/


Cheers,
Wojtek[/quote]

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





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


Re: [osg-users] How to get Camera Heading Pitch Roll

2016-05-23 Thread Sebastian Messerschmidt

Wojtek,



Hi,

Thanks!

Unfortunately There is a problem with line:

Code:

osg::Quat q_local = local_frame_inv * q;
I didn't provide actual compiling code here. I might very well be, that 
osg handles multiplication the other way round.


Cheers
Sebastian





no operator found...

Cheers,
Wojtek

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





___
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] How to get Camera Heading Pitch Roll

2016-05-23 Thread Wojtek Kowalski
Hi,

Thanks!

Unfortunately There is a problem with line:

Code:

osg::Quat q_local = local_frame_inv * q;




no operator found...

Cheers,
Wojtek

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





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


Re: [osg-users] Local Camera angles

2016-05-23 Thread Sebastian Messerschmidt

Hi Wojtek,

Use the the coordinateSystemNode:

osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode();
csn->setEllipsoidModel(new osg::EllipsoidModel());
osg::Matrixd local_frame = csn->computeLocalCoordinateFrame(position); 
//where position is your global position


The resulting matrix describes the position and orientation in the 
world-frame-

Hence the inverse will contain the local rotation. So in theory:

Quat q = your_world_rotation;//from the model_view
Mat local_frame_inv = inverse(local_frame);
Quat q_local = local_frame_inv * q;

The q_local will then represent the local rotation which you then can 
decompose into the HPR.


HTH
Sebastian



Hi,

How to get local rotation angles when camera is set by setViewMatrixAsLookAt?

I've got two camera modes:
1) Camera is set by global position and local angles

Code:
osg::Matrix worldMatrix;
ellipsoid->computeLocalToWorldTransformFromLatLongHeight(longitude, latitude, 
height, worldMatrix);

osg::Vec3 yawAxis( 0.f, 0.f, 1.f );
osg::Vec3 pitchAxis( 1.f, 0.f, 0.f );
osg::Vec3 rollAxis( 0.f, 1.f, 0.f );

//roll,pitch, yaw - local angles
osg::Matrix rotationMat = osg::Matrix::rotate(roll, rollAxis)// Roll
* osg::Matrix::rotate(pitch, pitchAxis)// Pitch
* osg::Matrix::rotate( yaw, yawAxis);// Yaw

camera>setViewMatrix(osg::Matrix::inverse(rotationMat * worldMatrix));




2) Camera is set by global eyepos, globalcenter and up vector

Code:
ECEFpnt (position in global) is calcualted from lot, lan, alt
osg::Vec3f upVec = ellipsoid->computeLocalUpVector(ECEFpnt.x(), ECEFpnt.y(), 
ECEFpnt.z());

camera->setViewMatrixAsLookAt(ECEFpnt, groundPosECEF, upVec);




How to get camera local angles in this case?!?!?

 From Mat -> angles I will use

Code:
osg::Vec3d getHPRfromQuat(osg::Quat quat)
{
double qx = quat.x();
double qy = quat.y();
double qz = quat.z();
double qw = quat.w();

double sqx = qx * qx;
double sqy = qy * qy;
double sqz = qz * qz;
double sqw = qw * qw;

double term1 = 2*(qx*qy+qw*qz);
double term2 = sqw+sqx-sqy-sqz;
double term3 = -2*(qx*qz-qw*qy);
double term4 = 2*(qw*qx+qy*qz);
double term5 = sqw - sqx - sqy + sqz;

double heading = atan2(term1, term2);
double pitch = atan2(term4, term5);
double roll = asin(term3);

return osg::Vec3d( heading, pitch, roll );
}


but I need local rotationMat! How!?:)

Thank you!

Cheers,
Wojtek[/code]

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





___
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] How to get Camera Heading Pitch Roll

2016-05-23 Thread Wojtek Kowalski
Hi,

You probably meant getHPRfromQuat(osg::Quat 
(cam->getProjectionMatrix().getRotate)), but as I know projectionMatrix has 
nothing to do with this angles, getVIewMatrix.getRotate() gives angles but I 
assume in world coordinates.

Any Help?


Cheers,
Wojtek

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





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


[osg-users] clamp mouse cursor / position

2016-05-23 Thread Sebastian Schmidt
Hi,

I'm trying to keep the mouse cursor in a specific area, while dragging a widget.
(f.e. scrollbar, 2d stick).

I cannot use requestWarpPointer, because this will recursively call my 
mouseDrag event.

Maybe its not a good behaviour at all, but still i wonder if its possible.
... 

Thank you!

Cheers,
Sebastian

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





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