What is the range of OpenGL texture ID?

守給你的承諾、 提交于 2019-11-27 23:42:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!