开发者

Checking if a texture is valid from its name

开发者 https://www.devze.com 2023-03-23 04:20 出处:网络
Is there a way to check to see if an opengl texture name set with glGenTextures has still got a valid texture associated with it? In the documentation I see there is a function glIsTexture, but it is

Is there a way to check to see if an opengl texture name set with glGenTextures has still got a valid texture associated with it? In the documentation I see there is a function glIsTexture, but it is not clear if this function returns GL_FALSE, if the texture has been d开发者_开发百科eleted.


This is... complicated.

If you have called glDeleteTextures on a texture name, then that name is no longer a texture... unless a later call to glGenTextures returns that name again. See, once you delete a texture, OpenGL is free to use that name later on. It's like deleting a pointer; it is possible that later memory allocations will return exactly that pointer again.

All glIsTexture can do is test to see if the texture is currently not a texture. It might become a texture again later.

0

精彩评论

暂无评论...
验证码 换一张
取 消