Do I have to delete all the textures I created (using glDeleteTextures) before the program exists, or does OpenGL delete the textures by himself?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- Is GLFW designed to use without LWJGL (in java)?
- thread_local variables initialization
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
Depending on what manages your OpenGL context, you may not need to delete the textures. For an example, see this question.
There does seem to be consensus, though, that it is good to clean up after yourself, but be careful when using C++ RAII to do so! If a C++ object that manages an OpenGL object via RAII is created or destroyed without an OpenGL context, undefined behavior will occur.
See: The Object Oriented Language Problem
The OpenGL API and OpenGL objects don't map intuitively to C++ OOP principles.
OpenGL resources are frees implicitly once all contexts with access to them are destroyed. OpenGL contexts of a process get destroyed when the client terminates; however in the case of indirect GLX context objects may be shared among X11 clients, so they may be freed only after the last client with access to them terminates.
Nevertheless it's always a good practice to clean up after yourself.