问题
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?
回答1:
0 is the value you're looking for (to represent an unset texture ID/uncreated texture), as 0 is never a valid texture ID.
回答2:
I would rather initialize the texture in the constructor. That way you never have an object in an invalid state.
回答3:
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
.
来源:https://stackoverflow.com/questions/7322147/what-is-the-range-of-opengl-texture-id