天天看点

OpenGL ES 3.0 渲染 16 bit unsigned short 灰度图(纹理)

作者:字节流动

来源:

https://blog.csdn.net/Kennethdroid/article/details/112863264

OpenGL ES 代码:

glTexImage2D ( GL_TEXTURE_2D, 0, GL_R16UI, width, height, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, data);      

shader 中使用:

uniform highp usampler2D s_texture;
float h = float(texture ( s_texture, a_position.xy ).r);      

参考

https://stackoverflow.com/questions/23408073/how-to-use-unsigned-short-in-an-opengl-shader https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
「视频云技术」你最值得关注的音视频技术公众号,每周推送来自阿里云一线的实践技术文章,在这里与音视频领域一流工程师交流切磋。
OpenGL ES 3.0 渲染 16 bit unsigned short 灰度图(纹理)

继续阅读