What is the range of OpenGL texture ID?

2019-01-25 08:34发布

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?

3条回答
啃猪蹄的小仙女
2楼-- · 2019-01-25 08:43

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

查看更多
forever°为你锁心
3楼-- · 2019-01-25 08:51

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

查看更多
Animai°情兽
4楼-- · 2019-01-25 09:08

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.

查看更多
登录 后发表回答