Skip to content

Constructors

In this case, a new pointer to an instance of osg::Geometry is created in C++ with:

new osg::Geometry
using C++'s new operator.

In Nim we can create a constructor as follows:

proc newGeometryRef*(): GeometryRef {.importcpp: "(new osg::Geometry)", 
                                      header: "<osg/Geometry>".}
where we use importcpp with the same code we used in C++.

So the equivalent to:

osg::ref_ptr<osg::Geometry> myTriangleGeometry = new osg::Geometry;
will be in Nim:
var myTriangleGeometry:GeometryRef = newGeometryRef()

Bug

cnew, constructor