jondinham
jondinham

Reputation: 8499

What is the range of OpenGL texture ID?

I have an object which owns a property Texture_ID. I need to initialize the value for Texture_ID in constructor, so I want some value unused by OpenGL to present that the texture is not yet set.

I don't know whether zero (0) is a good value? If there is a range that OpenGL applies to texture IDs, I want a value out of this range. Any idea?

Upvotes: 13

Views: 8729

Answers (3)

Shahbaz
Shahbaz

Reputation: 47603

0 is the value OpenGL uses for its own default texture. It never returns that value to you and you can use that value for your error checking.

I would although suggest using -1.

Upvotes: 3

R. Martinho Fernandes
R. Martinho Fernandes

Reputation: 234654

I would rather initialize the texture in the constructor. That way you never have an object in an invalid state.

Upvotes: 3

Christian Rau
Christian Rau

Reputation: 45968

0 is the value you're looking for (to represent an unset texture ID/uncreated texture), as 0 is never a valid texture ID.

Upvotes: 19

Related Questions