GL_ALPHA/GL_LUMINANCE/GL_INTENSITY之差别
来源:互联网 发布:ubuntu dd iso 安装盘 编辑:程序博客网 时间:2024/05/29 08:11
The difference between the three single-component texture formats, GL_ALPHA, GL_LUMINANCE and GL_INTENSITY, is in the way the four-component RGBA color vector is generated. If the value for a given texel is X, then the RGBA color vector generated is:
* GL_ALPHA: RGBA = (0, 0, 0, X)
* GL_LUMINANCE: RGBA = (X, X, X, 1)
* GL_INTENSITY: RGBA = (X, X, X, X)
In other words, if we interpret the alpha as transparency, GL_ALPHA would represent a completely black texture with varying transparency, GL_LUMINANCE is an opaque texture with varying color (a grayscale image), and GL_INTENSITY is a combination where both the color and alpha channel is varying.
一个很隐晦的错误:
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, nWidth, nHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data);
可以确定当前2D纹理是有效的,data图像数据是正确的,但最终得到的纹理显示出来的图像竟然是错误的?
查出 之前有一个glPixelStorei是错误根源, 当前的GL_PACK_ALIGNMENT,GL_UNPACK_ALIGNMENT,GL_UNPACK_ROW_LENGTH值会影响外部data最终到达纹理的方式,特别是GL_UNPACK_ROW_LENGTH!!!
Reference:
http://www.gamedev.net/community/forums/topic.asp?topic_id=307568
* GL_ALPHA: RGBA = (0, 0, 0, X)
* GL_LUMINANCE: RGBA = (X, X, X, 1)
* GL_INTENSITY: RGBA = (X, X, X, X)
In other words, if we interpret the alpha as transparency, GL_ALPHA would represent a completely black texture with varying transparency, GL_LUMINANCE is an opaque texture with varying color (a grayscale image), and GL_INTENSITY is a combination where both the color and alpha channel is varying.
一个很隐晦的错误:
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, nWidth, nHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data);
可以确定当前2D纹理是有效的,data图像数据是正确的,但最终得到的纹理显示出来的图像竟然是错误的?
查出 之前有一个glPixelStorei是错误根源, 当前的GL_PACK_ALIGNMENT,GL_UNPACK_ALIGNMENT,GL_UNPACK_ROW_LENGTH值会影响外部data最终到达纹理的方式,特别是GL_UNPACK_ROW_LENGTH!!!
Reference:
http://www.gamedev.net/community/forums/topic.asp?topic_id=307568
- GL_ALPHA/GL_LUMINANCE/GL_INTENSITY之差别
- GL_ALPHA/GL_LUMINANCE/GL_INTENSITY之差别
- GL_ALPHA/GL_LUMINANCE/GL_INTENSITY之差别
- 数据访问速度之差别
- 差别
- 差别
- PHP4与PHP5差别之simplexml_load_string
- MySQL VS SQL Server之用法差别
- nginx优化之request_time 和upstream_response_time差别
- IQueryable与IList差别之处
- bootstrap 学习笔记之span div差别
- nginx优化之request_time 和upstream_response_time差别
- CSS之visibility和display的差别
- nginx讲解之request_time 和upstream_response_time差别
- Visual C++.net与Visual C++6.0使用之差别
- V C++.net与VC++6.0使用之差别
- 在ACCESS中,"!"及"."符号之差别为何?
- TranslateMessage ().与 WindowProc的差别 之二. (调试了一天!!!)
- 简单字符串比较
- SystemVerilog笔记------散记
- AS3.0自定义滚动条(滚动内容可以为Sprite或MovieClip等)
- MySQL游标的使用笔记大全
- linux下查出cpu占用过高线程
- GL_ALPHA/GL_LUMINANCE/GL_INTENSITY之差别
- 高质量C\C++编程(一)
- 浅谈Javascript中undefined和null的区别
- 自己写个启动和关闭oracle服务的bat文件
- SQL多表连接查询(详细实例)
- UNICODE下字符转换(持续更新,欢迎补充)
- 百度地图 JavaScript API
- 使用命令行创建ARM LIB库
- QQ协议分析及其还原(转)