[osg-users] Problems porting from osg-3.4.0 to osg-3.6.0

Robert Osfield robert.osfield at gmail.com
Thu Sep 13 06:31:13 PDT 2018


Hi Harman

On Thu, 13 Sep 2018 at 13:55, Herman Varma <hermanvarma at eastlink.ca> wrote:
> 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.


> 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


More information about the osg-users mailing list