10/30/2022 0 Comments Opengl 5.0 download![]() ![]() This leaves two C++ objects which each intend to destroy the same OpenGL object. The compiler-generated copy constructor is wrong it copies the OpenGL object name, not the OpenGL object itself. This happens because we violated C++'s rule of 3/5: if you write for a class one of a destructor, copy/move constructor, or copy/move assignment operator, then you must write all of them. The copy that gets returned will therefore have an OpenGL object name that has been destroyed. And that resource will be destroyed by the destructor. But tex managed a resource: an OpenGL object. What is returned is not tex itself, but a copy of this object. ![]() What happens here? By the rules of C++, tex will be destroyed at the conclusion of this function call. The C++ principle of RAII says that if an object encapsulates a resource (like an OpenGL Object), the constructor should create the resource and the destructor should destroy it. #Opengl 5.0 download codeThis puts the onus on the user to correctly use them, but it also makes their working code seem more natural. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |