OpenGL绘制灰度图像的问题

clever101
博客专家认证
2007-04-02 01:20:25
OpenGL使用glDrawPixels绘制图像,其中一个参数是GLenum format,请问假使已经将一个256色的单波段的灰度图像的像素值读入缓存,那么这个GLenum format要设置为哪个值呢?我发现并没有合适的值啊!
...全文
672 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
clever101 2007-04-02
  • 打赏
  • 举报
回复
感谢syy64(太平洋) 大侠,你是对的。
syy64 2007-04-02
  • 打赏
  • 举报
回复
GL_LUMINANCE
Each pixel is a single luminance component.
The glDrawPixels function converts this component to the internal floating-point format in the same way that the red component of an RGBA pixel is, and then converts it to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to 1.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.

GL_UNSIGNED_BYTE
clever101 2007-04-02
  • 打赏
  • 举报
回复
灰度图像的一个像素就是一个字节(即八位),使用unsigned char *pBuffer进行存贮。
syy64 2007-04-02
  • 打赏
  • 举报
回复
看你用什么方式读,一个像素是三个字节吗?
wwwjava2 2007-04-02
  • 打赏
  • 举报
回复


给大家推荐个

好的技术群  大家一起学习啊

15356263

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧