Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Do I have to delete all the textures I created (using glDeleteTextures) before the program exists, or does OpenGL delete the textures by himself?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...