Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is 0 a valid OpenGL texture ID? [duplicate]

Tags:

opengl

glGenTextures(1, &textureid); 

Assuming that the texture was created succesfully, could textureid be 0?

like image 947
Tal Pressman Avatar asked Jul 10 '09 09:07

Tal Pressman


People also ask

What is OpenGL texture?

A texture is an OpenGL Object that contains one or more images that all have the same image format. A texture can be used in two ways: it can be the source of a texture access from a Shader, or it can be used as a render target.

What is a GL texture unit?

Texture units are references to texture objects that can be sampled in a shader. Textures are bound to texture units using the glBindTexture function you've used before. Because you didn't explicitly specify which texture unit to use, the texture was bound to GL_TEXTURE0 .

How are textures stored in OpenGL?

There are three kinds of storage for textures: mutable storage, immutable storage, and buffer storage. Only Buffer Textures can use buffer storage, where the texture gets its storage from a Buffer Object. And similarly, buffer textures cannot use mutable or immutable storage.


1 Answers

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.

like image 142
Chris Boyle Avatar answered Oct 04 '22 18:10

Chris Boyle