Hi, I’m trying to let the user create and delete my own box object that inherits 3dboxprimitive. I’m trying to use the delete keyword on a pointer that points to the box that the user wants to delete. I don’t think the block is being deleted correctly because when I try I get an error and the application crashes. How should I go about getting deleting the box.
you can’t delete something that hasn’t been allocated with new. in any case delete is probably not what you need. if you are drawing more than one primitive you can put them on a vector and remove then from there when you want to “delete” them.
You can also just clear the primitive mesh as in:
Or if you really want to remove the whole thing use a unique or shared pointer like:
and delete it by calling reset on it: