OpenGLES 1.1 and 2.0, supporting both
I have 2 separate renderers, one for 1.1 and another for 2.2
I have a bunch of Item
s which hold image information and the texture handle generated by whichever renderer I am using.
Items
are just dumb objects and I don't want to introduce any OpenGL specific functionality into them. The problem is, I need to store their texture handle somewhere. I would like to store it inside each Item
, however a handle is of type GLuint
.
If I use a GLuint
it means including either the gl.h from ES1/ or from ES2/. Now they are both typedef'd as unsigned ints... is it OK开发者_StackOverflow中文版 to just use an unsigned int? It seems like bad practice... For example if OpenGL 3.0 came out and a GLuint was something completely different, Item
would be broken.
Any ideas?
Thanks for reading.
Subsequent versions of OpenGL are supersets of their previous versions. The OpenGL specific types are meant to hide the underlying systems but be consistent across versions. For example if you have int as a 16 bit then GLuint might be defined as unsigned long.
Therefore I would say: Go with the smallest common denominator (ES1.1).
精彩评论