Hi!
I want to check if the single texture I loaded previously is still present in memory before I actually delete it.
I found out that I can actualy use two bethods to query if my texture is resident in memory.
frist method is “void glGetTexParameteriv( GLenum target, GLenum pname, GLint *params)”
and second is “GLboolean glAreTexturesResident( GLsizei n, GLuint *textures, GLboolean *residences)”
I guess teh difference between those two methods are that method one gets info about a single tex and second method about a group of textures! Am I right? if not then please let me know!!
Now. My question is how to use them? I spend some time playing around with those 2 methods and I am not sure how to use them! Could anyone help me with that!!
For example consider the following code:
GLuint m_unTgaTexture; // data member of the CTexture class
void CTexture::loadTextureTGA(char *filename, GLuint pixFormat, GLenum minfilter, GLenum magfilter, GLenum wrap)
{
// Build A Texture From The Data
glGenTextures(1, &m_unTgaTexture); // Generate OpenGL texture IDs
glBindTexture(GL_TEXTURE_2D, m_unTgaTexture); // Bind the Texture
… bla bla
}
// here is the problem!!!
void CTexture::destroyTexture()
{
//glGetTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_RESIDENT, ? ); // <<-- here I want to check first if texture is present in memory
glDeleteTextures(1, &m_unTgaTexture); //then destroy the texture
}
Do u think that this funcion glGetTexParameteriv will do the work or I need to use glAreTexturesResident. Which one?
Could you just show me how to use the appropriate function as I am lost! thanks for any help!!