Creating a 16 bit luminance texture in OpenGL ES 2.0 on iOS

天大地大妈咪最大 提交于 2019-12-08 03:57:28

问题


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

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