Reputation: 7317
glGenTextures(1, &textureid);
Assuming that the texture was created succesfully, could textureid be 0?
Upvotes: 42
Views: 11512
Reputation: 11551
The manual page for glGenTextures()
says see also glIsTexture()
; the latter will (according to that) always return GL_FALSE
for a texture name of 0. So, 0
can't be a valid texture name.
Upvotes: 39
Reputation: 6436
The correct way to do error checking in OpenGL is generally to call glGetError. You can then check for both of the error conditions listed in the description of glGenTextures. As also mentioned, you can call glIsTexture to check if a given texture is valid.
Upvotes: 2
Reputation: 794
From the OpenGL Spec 3.1: on page 157:
If a texture object is deleted, it as if all texture units which are bound to that texture object are rebound to texture object zero.
It seems to me that the zero named texture is a special one
Upvotes: 12