GLuint m_texture = 0;
glGenTexture(1, &m_texture);
if (glIsTexture(m_texture))
{
glBindTexture(GL_TEXTURE_2D, m_texture);
}
If I remove the glIsTexture() everything works as it should.
I can bind and unbind the Textures and use them as normal.. thats weird.
So in simple: glIsTexture() ALWAYS fails.
regards
glIsTexture fails always
I am confused.
Please note: I am using GLEW (newest version) while programming my stuff.
And from now to then my Texture-Class is not working anymore after
changing to FreeImage and doing a complete Rebuild.
Behold this small code:
glGenTexture does nothing more than returning an unused texture name and marking them as "used" for internal prupose only (in the sense that calling it again will not return the same name). The return value is, per definition, not a texture name yet. A texture name becomes used when glBindTexture is called on it for the first time.
So glIsTexture doesn't return true until you have bound it for the first time, thereby making the name a texture object.
So glIsTexture doesn't return true until you have bound it for the first time, thereby making the name a texture object.
Thanks for your reply.
Here is what I do with more detail:
So, when calling BindTexture() in the Application or LoadTexture a second Time, the Texture is ready to use. So glIsTexture should return GL_TRUE or not?
regards
Here is what I do with more detail:
dtTextureGL::LoadTexture(){ if (glIsTexture(m_texture)) { glDeleteTextures(1, &m_texture); } glGenTextures(1, &m_textures); glBindTexture(GL_TEXTURE_2D, m_texture); // Set Mipmaps, Data and Options etc... [.......] glBindTexture(GL_TEXTURE_2D, 0);}dtTextureGL::BindTexture(){ if (glIsTexture(m_texture)) { glBindTexture(GL_TEXTURE_2D, m_texture); }}dtTextureGL::UnbindTexture(){ glBindTexture(GL_TEXTURE_2D, 0);}
So, when calling BindTexture() in the Application or LoadTexture a second Time, the Texture is ready to use. So glIsTexture should return GL_TRUE or not?
regards
If you try to load a texture a second time with the same name, glIsTexture should return true, yes. Since it was previously loaded, it is also bound and created, so it then becomes a used name.
There is no need to use glIsTexture at all. Just check to see if m_texture is non-zero
[Edited by - V-man on July 28, 2008 6:01:45 PM]
dtTextureGL::BindTexture(){ if(m_texture) { glBindTexture(GL_TEXTURE_2D, m_texture); }}
[Edited by - V-man on July 28, 2008 6:01:45 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement