如何通过简单的乘法与其下面的颜色混合纹理颜色?
所以我希望我的纹理颜色与其下面的颜色相乘,如何使用 glBlendFunc() 来完成此操作?
例如:如果我有一个纹理颜色 (0.31, 0.51, 0.124) 并且其下有一个颜色 (0.83, 0.64, 0.12),则结果颜色将为 0.31*0.83, 0.51*0.64, 0.124*0.12。如何做到这一点?
So i want my texture colors to multiply with the colors under it, how this can be done with glBlendFunc() ?
For example: if i have a texture color (0.31, 0.51, 0.124) and there is a color (0.83, 0.64, 0.12) under it, the resulting color would be 0.31*0.83, 0.51*0.64, 0.124*0.12. How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过“纹理颜色”,我假设您的意思是“glTexEnv 过程输出的颜色”。或者,使用更严格的OpenGL规范语言,片段颜色。
无论如何,这都是一个简单的混合问题。如果您使用的是 OpenGL 2.1 或更高版本:
这会导致目标颜色(帧缓冲区中的内容)与源颜色(glTexEnv 中的内容)相乘,并添加到零(从技术上讲,零乘以目标颜色)。
By "texture colors", I'm going to assume that you mean "the color output by the glTexEnv process". Or, using more rigorous OpenGL spec language, the fragment color.
In any case, this is a simple matter of blending. If you're using OpenGL 2.1 or above:
This causes the destination color (what's in the framebuffer) to be multiplied with the source color (what comes out of glTexEnv), and added to zero (technically, zero times the destination color).