I’m using optixpp_namespace.h but it doesn’t seem to be destroying objects correctly.
If we take a ContextObj as an example, this is derived from ScopedObj/DestroyableObj and implements a virtual function destroy() which destroys the Context.
There’s nowhere in this hierarchy that destroy() is actually called, so even though my Handle refcount has hit 0 and my ScopedObj is destroyed through the call to Handle::unref() the call to ContextObj::destroy never happens.
Correct and unfortunately intended. The implementation design of the OptiX C++ wrapper was chosen to be just a flat layer over the C-API and the underlying OptiX objects need to be destroyed explicitly.
That’s like this since OptiX 1.0 and I needed to explain that often (e.g. [url]https://devtalk.nvidia.com/default/topic/989677/?comment=5084094[/url] comment #6)
If you wanted to implement a class hierarchy which builds a shadow scene graph on the host, I’d recommend to roll you own classes and use the C-API directly inside them. The optixpp_namespace.h can be used as a starting point for that.