OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Problems porting from osg-3.4.0 to osg-3.6.0


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Wed Sep 12, 2018 3:29 pm    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hello I am having trouble porting Ben Discoe’s VTP software from openSceneGraph-3.4.0 to osg-3.6.2

The problem lies in implementing the macro to replace META_object in shadowTechnique.h as depicted below.
. Can someone point out where my problem is.

/** CSimpleInterimShadowTechnique provides an implementation of a depth map shadow tuned to the needs of VTP.*/
class CSimpleInterimShadowTechnique : public osgShadow::ShadowTechnique
{
public:

// working ********************** in openSceneGraph-3.4.0
// CSimpleInterimShadowTechnique();
// CSimpleInterimShadowTechnique(const
// CSimpleInterimShadowTechnique& es, const osg::CopyOp&
// copyop=osg::CopyOp::SHALLOW_COPY);
// META_Object(osgShadow, CSimpleInterimShadowTechnique);
//***********************************************************

// Macro not working *****************in openSceneGraph-3.6.2
CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return "CSimpleInterimShadowTechnique"; }


//**************************************************************

In the new implementation I am getting a C2259 error

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): error C2259: 'CSimpleInterimShadowTechnique': cannot instantiate abstract class

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: due to following members:

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object *osg::Object::cloneType(void) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(80): note: see declaration of 'osg::Object::cloneType'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object *osg::Object::clone(const osg::CopyOp &) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(84): note: see declaration of 'osg::Object::clone'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void osgShadow::ShadowTechnique::resizeGLObjectBuffers(unsigned int)': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(66): note: see declaration of 'osgShadow::ShadowTechnique::resizeGLObjectBuffers'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void osgShadow::ShadowTechnique::releaseGLObjects(osg::State *) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(71): note: see declaration of 'osgShadow::ShadowTechnique::releaseGLObjects'

The area where the error manifests is in this section of nodeOSG.cpp

//////////////////////////////////////////////////////////////////////
// vtShadow
//

vtShadow::vtShadow(const int ShadowTextureUnit, int LightNumber) :
m_ShadowTextureUnit(ShadowTextureUnit), m_LightNumber(LightNumber)
{
setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
setCastsShadowTraversalMask(CastsShadowTraversalMask);

#if VTLISPSM
osg::ref_ptr<CLightSpacePerspectiveShadowTechnique> pShadowTechnique = new CLightSpacePerspectiveShadowTechnique;
// No need to set the BaseTextureUnit as the default of zero is OK for us
// But the ShadowTextureUnit might be different (default 1)
pShadowTechnique->setShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->setLightNumber(m_LightNumber);
#else
//errorC2259 cannot instantiate abstract class in openSceneGraph-3.6.2
//statement working in osg-3.4.0
osg::ref_ptr<CSimpleInterimShadowTechnique> pShadowTechnique = new CSimpleInterimShadowTechnique;//*****************************Error here
#endif

#if !VTLISPSM
#if VTDEBUGSHADOWS
// add some instrumentation
pShadowTechnique->m_pParent = this;
#endif

pShadowTechnique->SetLightNumber(LightNumber);
pShadowTechnique->SetShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->SetShadowSphereRadius(50.0);
#endif
setShadowTechnique(pShadowTechnique.get());

SetOsgNode(this);
}

Help would be appreciated


Cheers,
Herman
Back to top
View user's profile Send private message Send e-mail
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Sep 13, 2018 7:13 am    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Herman,

To make sure that shadow techniques properly handling applications
opening new windows and properly handle clean up they need to
implement the resizeGLObjectBuffers(..) and releaseGLObjects(..)
methods. In 3.6.x to ensure this is done these methods are pure
virtual forcing the subclasses to implement them. The ShadowTechnique
implementation looks like:

/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;

/** If State is non-zero, this function releases any
associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objects
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const = 0;

META_Object can only be used with concrete classes so you can't use it
in this for ShadowTechnique.

For the custom ShadowTechnique you simply need to provide
resizeGLObjectBuffers(..) and releaseGLObjects(..). To see what they
would need to be have a look at the various ShadowTechnique subclasses
in src/osgShadow.

Cheers,
Robert.
On Thu, 13 Sep 2018 at 07:48, Herman Varma <> wrote:
Quote:

Hello I am having trouble porting Ben Discoe’s VTP software from openSceneGraph-3.4.0 to osg-3.6.2

The problem lies in implementing the macro to replace META_object in shadowTechnique.h as depicted below.
. Can someone point out where my problem is.

/** CSimpleInterimShadowTechnique provides an implementation of a depth map shadow tuned to the needs of VTP.*/
class CSimpleInterimShadowTechnique : public osgShadow::ShadowTechnique
{
public:

// working ********************** in openSceneGraph-3.4.0
// CSimpleInterimShadowTechnique();
// CSimpleInterimShadowTechnique(const
// CSimpleInterimShadowTechnique& es, const osg::CopyOp&
// copyop=osg::CopyOp::SHALLOW_COPY);
// META_Object(osgShadow, CSimpleInterimShadowTechnique);
//***********************************************************

// Macro not working *****************in openSceneGraph-3.6.2
CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return "CSimpleInterimShadowTechnique"; }


//**************************************************************

In the new implementation I am getting a C2259 error

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): error C2259: 'CSimpleInterimShadowTechnique': cannot instantiate abstract class

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: due to following members:

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object *osg::Object::cloneType(void) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(80): note: see declaration of 'osg::Object::cloneType'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object *osg::Object::clone(const osg::CopyOp &) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(84): note: see declaration of 'osg::Object::clone'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void osgShadow::ShadowTechnique::resizeGLObjectBuffers(unsigned int)': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(66): note: see declaration of 'osgShadow::ShadowTechnique::resizeGLObjectBuffers'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void osgShadow::ShadowTechnique::releaseGLObjects(osg::State *) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(71): note: see declaration of 'osgShadow::ShadowTechnique::releaseGLObjects'

The area where the error manifests is in this section of nodeOSG.cpp

//////////////////////////////////////////////////////////////////////
// vtShadow
//

vtShadow::vtShadow(const int ShadowTextureUnit, int LightNumber) :
m_ShadowTextureUnit(ShadowTextureUnit), m_LightNumber(LightNumber)
{
setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
setCastsShadowTraversalMask(CastsShadowTraversalMask);

#if VTLISPSM
osg::ref_ptr<CLightSpacePerspectiveShadowTechnique> pShadowTechnique = new CLightSpacePerspectiveShadowTechnique;
// No need to set the BaseTextureUnit as the default of zero is OK for us
// But the ShadowTextureUnit might be different (default 1)
pShadowTechnique->setShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->setLightNumber(m_LightNumber);
#else
//errorC2259 cannot instantiate abstract class in openSceneGraph-3.6.2
//statement working in osg-3.4.0
osg::ref_ptr<CSimpleInterimShadowTechnique> pShadowTechnique = new CSimpleInterimShadowTechnique;//*****************************Error here
#endif

#if !VTLISPSM
#if VTDEBUGSHADOWS
// add some instrumentation
pShadowTechnique->m_pParent = this;
#endif

pShadowTechnique->SetLightNumber(LightNumber);
pShadowTechnique->SetShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->SetShadowSphereRadius(50.0);
#endif
setShadowTechnique(pShadowTechnique.get());

SetOsgNode(this);
}

Help would be appreciated


Cheers,
Herman

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Thu Sep 13, 2018 12:47 pm    Post subject:
Reply with quote

Hi Robert,

I am new in OSG so please be patient. I am still reading the book.

Just to clarify I should replace in the class CSimpleInterimShadowTechnique


CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, CSimpleInterimShadowTechnique);


with

CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return "CSimpleInterimShadowTechnique"; }


removing META_object
and also add

/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;

/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objects
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const = 0;

to the class.

Do I have this right?









Thank you!

Cheers,
Herman
Back to top
View user's profile Send private message Send e-mail
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Sep 13, 2018 1:32 pm    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Harman

On Thu, 13 Sep 2018 at 13:55, Herman Varma <> wrote:
Quote:
Just to clarify I should replace in the class CSimpleInterimShadowTechnique


CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, CSimpleInterimShadowTechnique);


with

CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return "CSimpleInterimShadowTechnique"; }

There should be no need to replace the use of META_Object, the
original code should be fine. The only reason why META_Object macro
wasn't working is because the CSimpleInterimShadowTechnique doesn't
implement the pure virtual methods that have been added in 3.6.x - the
ones I mentioned above.


Quote:
and also add

/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;

/** If State is non-zero, this function releases any associated OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objects
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const = 0;

to the class.

Do I have this right?

Yes, but you'll have to actually implement as well :-)

Have a look at the include/osgShadow/ShadowMap example as it
subclasses from ShadowTechnique is uses META_Objects and override the
required methods. Have a look at the src/osgShadow/ShadowMap.cpp to
see how the
resizeGLObjectBuffers and releaseGLObjects are implemented.

Robert


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Fri Sep 14, 2018 1:23 pm    Post subject:
Reply with quote

Hi Robert

Just to let you know everything compiled and worked.
Thanks to your input I have Ben Discoe's software up and running with
OSG-3.6.2. He does not appear to be supporting VTP since 2015.


Thank you!

Cheers,
Herman
Back to top
View user's profile Send private message Send e-mail
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Fri Sep 14, 2018 2:50 pm    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Herman,

On Fri, 14 Sep 2018 at 15:00, Herman Varma <> wrote:
Quote:
Thanks to your input I have Ben Discoe's software up and running with
OSG-3.6.2. He does not appear to be supporting VTP since 2015.

Good to hear that you've completed the port.

OpenSceneGraph-3.6.3 is out now so you'll have to start all over again!

Thought this time is shouldn't be anything more than a recompile :-)

Cheers
Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Sun Sep 23, 2018 2:51 pm    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Robert,

Just a quick note.
In OpenSceneGraph-3.6.2 in the mipmap.cpp module.
I got a warning
c:\apis\openscenegraph-3.6.2\src\osg\glu\libutil\mipmap.cpp(6490): warning
C4701: potentially uninitialized local variable 'outindex' used

I initialized the declaration on line 6116
To int outindex=0;

Everything works



-----Original Message-----
From: osg-users [mailto:] On
Behalf Of
Sent: Thursday, September 13, 2018 5:04 PM
To:
Subject: osg-users Digest, Vol 135, Issue 16

Send osg-users mailing list submissions to


To subscribe or unsubscribe via the World Wide Web, visit

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

or, via email, send a message with subject or body 'help' to


You can reach the person managing the list at


When replying, please edit your Subject line so it is more specific
than "Re: Contents of osg-users digest..."


Today's Topics:

1. Re: Problems porting from osg-3.4.0 to osg-3.6.0 (Herman Varma)
2. Re: Advice requested: Is OSG what I need for my project?
(Jan Ciger)
3. Re: Problems porting from osg-3.4.0 to osg-3.6.0 (Robert Osfield)
4. Re: Advice requested: Is OSG what I need for my project?
(Chris Hanson)
5. Re: problems with osg-3.4.0 port to osg-3.6.0 (Chris Hanson)


----------------------------------------------------------------------

Message: 1
Date: Thu, 13 Sep 2018 14:47:55 +0200
From: "Herman Varma" <>
To:
Subject: Re: Problems porting from osg-3.4.0 to osg-3.6.0
Message-ID: <>
Content-Type: text/plain; charset=UTF-8

Hi Robert,

I am new in OSG so please be patient. I am still reading the book.

Just to clarify I should replace in the class CSimpleInterimShadowTechnique


CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique&
es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, CSimpleInterimShadowTechnique);


with

CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es, const
osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return
dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return
"CSimpleInterimShadowTechnique"; }


removing META_object
and also add

/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;

/** If State is non-zero, this function releases any associated
OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL
objects
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const = 0;

to the class.

Do I have this right?









Thank you!

Cheers,
Herman

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







------------------------------

Message: 2
Date: Thu, 13 Sep 2018 14:53:57 +0200
From: Jan Ciger <>
To: OpenSceneGraph Users <>
Subject: Re: Advice requested: Is OSG what I need for my
project?
Message-ID:
<CALFd4CcHBQWNO99exD-uHA979NDf0v1ba0CL6VU+>
Content-Type: text/plain; charset="utf-8"

On Thu, 13 Sep 2018 at 14:45, Scott Schultz <> wrote:

Quote:
;tldr version:

Given a start point and end point, can OSG give me a list of collisions
with geometry along the specified line segment?


Sure it can do that. There is even an example in the repository for it:
https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgint
ersection/osgintersection.cpp

J,
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/atta
chments/20180913/8273eefd/attachment-0001.html>

------------------------------

Message: 3
Date: Thu, 13 Sep 2018 14:31:13 +0100
From: Robert Osfield <>
To: OpenSceneGraph Users <>
Subject: Re: Problems porting from osg-3.4.0 to osg-3.6.0
Message-ID:
<CAFN7Y+VjnAzmb6zJMV+Qq83TwWnb+bd-79SEn7=Q-=>
Content-Type: text/plain; charset="UTF-8"

Hi Harman

On Thu, 13 Sep 2018 at 13:55, Herman Varma <> wrote:
Quote:
Just to clarify I should replace in the class
CSimpleInterimShadowTechnique
Quote:


CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique&
es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
Quote:
META_Object(osgShadow, CSimpleInterimShadowTechnique);


with

CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique& es,
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
Quote:

virtual bool isSameKindAs(const osg::Object* obj) const { return
dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
Quote:
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return
"CSimpleInterimShadowTechnique"; }

There should be no need to replace the use of META_Object, the
original code should be fine. The only reason why META_Object macro
wasn't working is because the CSimpleInterimShadowTechnique doesn't
implement the pure virtual methods that have been added in 3.6.x - the
ones I mentioned above.


Quote:
and also add

/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;

/** If State is non-zero, this function releases any associated
OpenGL objects for
Quote:
* the specified graphics context. Otherwise, releases OpenGL
objects
Quote:
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const = 0;

to the class.

Do I have this right?

Yes, but you'll have to actually implement as well :-)

Have a look at the include/osgShadow/ShadowMap example as it
subclasses from ShadowTechnique is uses META_Objects and override the
required methods. Have a look at the src/osgShadow/ShadowMap.cpp to
see how the
resizeGLObjectBuffers and releaseGLObjects are implemented.

Robert


------------------------------

Message: 4
Date: Thu, 13 Sep 2018 18:55:17 +0100
From: Chris Hanson <>
To: OpenSceneGraph Users <>
Subject: Re: Advice requested: Is OSG what I need for my
project?
Message-ID:
<CAGoufmYjmum=E=dJbzN2rtGvr+OnSoKLnrSATpB9CjQEb+>
Content-Type: text/plain; charset="utf-8"

Seconded, yes.

You can also potentially make hierarchical structures of the graph to
improve the performance of the intersection process.

You would not need ODE.

You could even construct an OSG loader to deserialize the sphereville graph
natively so that you could use OSG's databasepager and LOD tools to roam
around the graph loading and unloading the bounds dynamically.

On Thu, Sep 13, 2018 at 1:54 PM Jan Ciger <> wrote:

Quote:

On Thu, 13 Sep 2018 at 14:45, Scott Schultz <> wrote:

Quote:
;tldr version:

Given a start point and end point, can OSG give me a list of collisions
with geometry along the specified line segment?


Sure it can do that. There is even an example in the repository for it:


https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgint
ersection/osgintersection.cpp
Quote:

J,




--
Chris 'Xenon' Hanson, omo sanza lettere.
http://www.alphapixel.com/
Training ? Consulting ? Contracting
3D ? Scene Graphs (Open Scene Graph/OSG) ? OpenGL 2 ? OpenGL 3 ? OpenGL 4 ?
GLSL ? OpenGL ES 1 ? OpenGL ES 2 ? OpenCL
Legal/IP ? Forensics ? Imaging ? UAVs ? GIS ? GPS ?
osgEarth ? Terrain ? Telemetry ? Cryptography ? LIDAR ? Embedded ? Mobile ?
iPhone/iPad/iOS ? Android
@alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel (775)
623-PIXL [7495]
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/atta
chments/20180913/235e9fc0/attachment-0001.html>

------------------------------

Message: 5
Date: Thu, 13 Sep 2018 18:57:00 +0100
From: Chris Hanson <>
To: OpenSceneGraph Users <>
Subject: Re: problems with osg-3.4.0 port to osg-3.6.0
Message-ID:
<CAGoufmbP22J-HO74xLp_XJkjoZmJ_bTpEmTHg=>
Content-Type: text/plain; charset="utf-8"

Did you ask Ben himself?

He's moving to Hawaii just now, but might be able to comment. I can ping
him if you don't get an answer here.

On Thu, Sep 13, 2018 at 7:48 AM Herman Varma <>
wrote:

Quote:
Hello I am having trouble porting Ben Discoe?s VTP software from
openSceneGraph-3.4.0 to osg-3.6.2

The problem lies in replacing the META_object with a macro in
shadowTechnique.h as depicted below.

Can someone point out where the problem is.

/** CSimpleInterimShadowTechnique provides an implementation of a depth
map shadow tuned to the needs of VTP.*/

class CSimpleInterimShadowTechnique : public osgShadow::ShadowTechnique
{
public:

// working ********************** in opemSceneGraph-3.4.0
// CSimpleInterimShadowTechnique();
// CSimpleInterimShadowTechnique(const
// CSimpleInterimShadowTechnique& es, const osg::CopyOp&
// copyop=osg::CopyOp::SHALLOW_COPY);
// META_Object(osgShadow, CSimpleInterimShadowTechnique);
//***********************************************************

// not working *********************in opemSceneGraph-3.6.2
CSimpleInterimShadowTechnique();
CSimpleInterimShadowTechnique(const CSimpleInterimShadowTechnique&
es, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

virtual bool isSameKindAs(const osg::Object* obj) const { return
dynamic_cast<const CSimpleInterimShadowTechnique*>(obj) != NULL; } \
virtual const char* libraryName() const { return "osgShadow"; }\
virtual const char* className() const { return
"CSimpleInterimShadowTechnique"; }


//**************************************************************


In the new implementation I am getting a C2259 error

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): error C2259:
'CSimpleInterimShadowTechnique': cannot instantiate abstract class

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: due to
following members:

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object
*osg::Object::cloneType(void) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(80): note: see
declaration of 'osg::Object::cloneType'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'osg::Object
*osg::Object::clone(const osg::CopyOp &) const': is abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osg\object(84): note: see
declaration of 'osg::Object::clone'

2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void
osgShadow::ShadowTechnique::resizeGLObjectBuffers(unsigned int)': is
abstract


2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(66):
Quote:
note: see declaration of
'osgShadow::ShadowTechnique::resizeGLObjectBuffers'
Quote:
2>c:\vtp_vsc\terrainsdk\vtlib\vtosg\nodeosg.cpp(1026): note: 'void
osgShadow::ShadowTechnique::releaseGLObjects(osg::State *) const': is
abstract

2>c:\apis\openscenegraph-3.6.2\build\include\osgshadow\shadowtechnique(71):
Quote:
note: see declaration of 'osgShadow::ShadowTechnique::releaseGLObjects'

The error manifests is in the vtShadow section of nodeOSG.cpp

//////////////////////////////////////////////////////////////////////
// vtShadow
//

vtShadow::vtShadow(const int ShadowTextureUnit, int LightNumber) :
m_ShadowTextureUnit(ShadowTextureUnit), m_LightNumber(LightNumber)
{
setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
setCastsShadowTraversalMask(CastsShadowTraversalMask);

#if VTLISPSM
osg::ref_ptr<CLightSpacePerspectiveShadowTechnique>
pShadowTechnique = new CLightSpacePerspectiveShadowTechnique;
// No need to set the BaseTextureUnit as the default of zero is OK
for us
// But the ShadowTextureUnit might be different (default 1)
pShadowTechnique->setShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->setLightNumber(m_LightNumber);
#else

//errorC2259 cannot instantiate abstract class in openSceneGraph-3.6.2
//working in osg-3.4.0

osg::ref_ptr<CSimpleInterimShadowTechnique> pShadowTechnique = new

#endif

#if !VTLISPSM
#if VTDEBUGSHADOWS
// add some instrumentation
pShadowTechnique->m_pParent = this;
#endif

pShadowTechnique->SetLightNumber(LightNumber);
pShadowTechnique->SetShadowTextureUnit(m_ShadowTextureUnit);
pShadowTechnique->SetShadowSphereRadius(50.0);
#endif
setShadowTechnique(pShadowTechnique.get());

SetOsgNode(this);
}

Help would be appreciated


Thank you!

Cheers,

Herman Varma
Head of Cartographic Research
Bedford Institute of Oceanography

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









--
Chris 'Xenon' Hanson, omo sanza lettere.
http://www.alphapixel.com/
Training ? Consulting ? Contracting
3D ? Scene Graphs (Open Scene Graph/OSG) ? OpenGL 2 ? OpenGL 3 ? OpenGL 4 ?
GLSL ? OpenGL ES 1 ? OpenGL ES 2 ? OpenCL
Legal/IP ? Forensics ? Imaging ? UAVs ? GIS ? GPS ?
osgEarth ? Terrain ? Telemetry ? Cryptography ? LIDAR ? Embedded ? Mobile ?
iPhone/iPad/iOS ? Android
@alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel (775)
623-PIXL [7495]
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/atta
chments/20180913/ec89c50a/attachment-0001.html>

------------------------------

Subject: Digest Footer




------------------------------

End of osg-users Digest, Vol 135, Issue 16
******************************************



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message Send e-mail
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Tue Oct 02, 2018 4:18 am    Post subject:
"Problems porting from osg-3.4.0 to osg-3.6.0"
Reply with quote

Hi,


I have encountered another problem. what is the replacement for
_boundingBoxComputed in osg-3.6.2

in osg-3.4.0
It was defined in osg\Drawable


BoundingBox _initialBound;
ref_ptr<ComputeBoundingBoxCallback> _computeBoundCallback;
mutable BoundingBox _boundingBox;
mutable bool _boundingBoxComputed;

in osg-3.6.2
it is not defined in osg\Drawable

BoundingBox _initialBoundingBox;
ref_ptr<ComputeBoundingBoxCallback>_computeBoundingBoxCallback;
mutable BoundingBox _boundingBox;



The code to be ported is

osg::BoundingBox OsgDynMesh::computeBoundingBox() const
{
FBox3 box;
m_pDynGeom->DoCalcBoundBox(box);

// convert it to OSG bounds
v2s(box.min, _boundingBox._min);
v2s(box.max, _boundingBox._max);

_boundingBoxComputed=true;
return _boundingBox;
}

Thank you!

Cheers,
Herman
Back to top
View user's profile Send private message Send e-mail
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Tue Oct 02, 2018 1:42 pm    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Herman,

With the change to subclassing Drawable from Node rather than Object,
the dirty flag is now inherited from Node, it's a bit awkward as it's
now _boundingSphereComputed, but it's essentially the same thing.

However, your own code should worry about the dirty flag, that's the
job of the getBound()/getBoundingBox() job to worry about, and this
has always been the case - it's an example of the Template Method
Design Pattern. The getBound*() method provides the high level
managing of dirty status that always needs to be managed coherently
and the compute*() method provides the part that differs.

So in your code just delete the line:

_boundingBoxComputed=true;

It will work fine for 3.4.x and 3.6.x without this line as it was
never needed in the first place :-)

Robert.
On Tue, 2 Oct 2018 at 12:25, Herman Varma <> wrote:
Quote:

Hi,


I have encountered another problem. what is the replacement for
_boundingBoxComputed in osg-3.6.2

in osg-3.4.0
It was defined in osg\Drawable


BoundingBox _initialBound;
ref_ptr<ComputeBoundingBoxCallback> _computeBoundCallback;
mutable BoundingBox _boundingBox;
mutable bool _boundingBoxComputed;

in osg-3.6.2
it is not defined in osg\Drawable

BoundingBox _initialBoundingBox;
ref_ptr<ComputeBoundingBoxCallback>_computeBoundingBoxCallback;
mutable BoundingBox _boundingBox;



The code to be ported is

osg::BoundingBox OsgDynMesh::computeBoundingBox() const
{
FBox3 box;
m_pDynGeom->DoCalcBoundBox(box);

// convert it to OSG bounds
v2s(box.min, _boundingBox._min);
v2s(box.max, _boundingBox._max);

_boundingBoxComputed=true;
return _boundingBox;
}

Thank you!

Cheers,
Herman

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
hvarma (Herman Varma)
Newbie


Joined: 12 Sep 2018
Posts: 11

PostPosted: Thu Oct 04, 2018 1:31 pm    Post subject:
"Problems porting from osg-3.4.0 to osg-3.6.0"
Reply with quote

Hi,


I have upgraded the vtp code to osg 3.6.3
Everything compiled and linked properly. However I still have some execution problems.

I just want to check if the code below is coded properly

FQuat TransformExtension::GetOrient() const
{
const osg::Matrix &xform = m_pTransform->getMatrix();
osg::Quat q;

// xform.get(q);
// Replacing xform.get(q)
// with
q = xform.getRotate();

return FQuat(q.x(), q.y(), q.z(), q.w());
}

...

Thank you!

Cheers,
Herman
Back to top
View user's profile Send private message Send e-mail
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Fri Oct 05, 2018 7:05 am    Post subject:
Problems porting from osg-3.4.0 to osg-3.6.0
Reply with quote

Hi Harman,

The new code looks OK to me. Can't say anything more about the
issues you are having though as you don't provide any specifics. If
you can keep VTP compiling against new and older versions of the OSG
for a while then you could possibly put some debug output on bits of
code that you are suspicious of and see what values both versions of
the OSG are generating, or create a small test program that
illustrates the usage case that you think might be a problems and so
similar testing.

If it does turn out there is change in behaviour then the later
approach would be helpful for others to test things out to see what
might be going on. If there is bug on 3.6.x then we can fix it and
make sure it's part of the next stable point release.

Cheers,
Robert.
On Thu, 4 Oct 2018 at 14:31, Herman Varma <> wrote:
Quote:

Hi,


I have upgraded the vtp code to osg 3.6.3
Everything compiled and linked properly. However I still have some execution problems.

I just want to check if the code below is coded properly

FQuat TransformExtension::GetOrient() const
{
const osg::Matrix &xform = m_pTransform->getMatrix();
osg::Quat q;

// xform.get(q);
// Replacing xform.get(q)
// with
q = xform.getRotate();

return FQuat(q.x(), q.y(), q.z(), q.w());
}

...

Thank you!

Cheers,
Herman

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts some osgOcean problems Liyanru101 osgOcean [osgOcean] 0 Fri Nov 16, 2018 3:55 am View latest post
No new posts Problems with forum. poweruserm@live.com.au General 1 Sun Oct 28, 2018 11:45 pm View latest post
No new posts Porting application from OSG 3.0 to O... Daniel Trstenjak General 1 Fri Oct 26, 2018 9:15 am View latest post
No new posts porting from osg-3.4.0 to osg-3.6.3 hvarma General 7 Sun Oct 07, 2018 5:21 pm View latest post
No new posts problems with osg-3.4.0 port to osg-3... Herman Varma General 4 Wed Sep 12, 2018 2:26 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP