问题
I have 16 bit data in a file, which I am trying to load into an OpenGL luminance texture on iOS. If I rescale the 16 bit values to 8 bit manually, I am able to load and display the data as follows:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE,GL_UNSIGNED_BYTE,
(void*)data_8bit);
But can I make glTexImage2D do the conversion from 16 to 8 bit?
Looking at the OpenGL 2.0 spec, the allowed values for 16 bit type are:
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4 GL_UNSIGNED_SHORT_5_5_5_1
There is no GL_UNSIGNED_SHORT, and I don't think I can use any of the above.
I am using iOS 5.1 and Xcode 4.3.2.
来源:https://stackoverflow.com/questions/11072990/creating-a-16-bit-luminance-texture-in-opengl-es-2-0-on-ios