如何在 OpenGL 中将图像转换为灰度图像?

发布于 2024-10-09 00:04:02 字数 126 浏览 0 评论 0原文

这似乎是一个简单的问题,但我想知道在 OpenGL 中将 RGBA 图像转换为灰度图像而不使用 GLSL 的最快技术。即如何使用以下公式获取 RGBA 纹理并将其转换为普通的单通道纹理: 输出=0.3*红色+0.59*绿色+0.11*蓝色

This might seem like a simple question but Id like to know the fastest technique for converting an RGBA image to a grayscale image in OpenGL WITHOUT using GLSL. I.e. How do I take an RGBA texture and convert it to a plain single channel texture using the following formula:
output=0.3*RED + 0.59*GREEN + 0.11*Blue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌面超妹 2024-10-16 00:04:03

好吧,我不知道“最快”,但您应该能够执行与本教程相反的操作并获得您正在寻找的灰度图像。技术是相同的,只是向后。

http://nehe.gamedev.net/data/lessons/lesson.asp ?课程=37

Well I don't know about "fastest", but you should be able to do the opposite of this tutorial and get the greyscale image you're looking for. The techniques are the same just backwards.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=37

醉殇 2024-10-16 00:04:02

您也许能够说服 GL_DOT3_RGB 做你想做的事。

You might be able to convince GL_DOT3_RGB to do what you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文