删除opengl中的纹理 [英] Deleting textures in opengl

查看:424
本文介绍了删除opengl中的纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在程序存在之前删除我创建的所有纹理(使用glDeleteTextures),否则OpenGL会自己删除纹理?

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

推荐答案

根据你的OpenGL上下文的管理,你可能不需要删除纹理。有关示例,请参见此问题

Depending on what manages your OpenGL context, you may not need to delete the textures. For an example, see this question.

然而,似乎有一个共识,即在自己之后清理是很好的,但在使用C ++ RAII时要小心!如果通过RAII管理OpenGL对象的C ++对象在没有OpenGL上下文的情况下被创建或销毁,将会出现未定义的行为。

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

OpenGL API和OpenGL对象不直观地映射到C ++ OOP原则。

The OpenGL API and OpenGL objects don't map intuitively to C++ OOP principles.

这篇关于删除opengl中的纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆