[osg-users] problems with osg-3.4.0 port to osg-3.6.0
Herman Varma
hermanvarma at eastlink.ca
Wed Sep 12 18:31:28 PDT 2018
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): 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 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
More information about the osg-users
mailing list