This question already has an answer here:
I have never really worked with std::shared_ptr s before and I want to manage my VAOs, VBOs and EBOs with them.
For them to be destroyed properly a function called glDeleteBuffers for the VBO and EBO and glDeleteVertexArrays for the VAO needs to be called.
I know that shared pointers automatically destroy the object they manage as soon as the last shared pointer pointing to said objects gets destroyed or unlinked. However I have not seen a way to define the destructor used when the respective object gets destroyed.
I know I could make a class that simply has a constructor and a destructor and a VAO, VBO and EBO as members and have a shared pointer point to a instance of said class, however I feel like knowing how to define a destructor in cases like this would still be useful.
How can I define such a destructor?
Aucun commentaire:
Enregistrer un commentaire