如何在opengl中混合颜色 [英] how mix color in opengl

查看:163
本文介绍了如何在opengl中混合颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何身体告诉我如何混合颜色

1:如果我想要深品红色值怎么样这个

i知道洋红色gcolor3f(1.0,0.0,1.0)< br $>




2:再次感到暗红色vaule

gcolor3f(1.0,0.0,0.0)这个red

any body tell me how mix color
1:for ex if i want dark magenta value how this
i know the magenta gcolor3f(1.0,0.0,1.0)


2:again iwant get dark red color vaule
gcolor3f(1.0,0.0,0.0) this for red

推荐答案

如果您想要现有颜色的较暗变体,只需按比例降低所有R,G,B值。例如,要使洋红色(1.0,0.0,1.0)变暗,将所有分量乘以0.5,得到(0.5,0.0,0.5)。



An尝试使用颜色值的好方法是打开Windows颜色对话框,看看更改一个多个值的效果。此外,尝试不同的颜色系统,如HSI,看看它们之间的关系。
If you want a darker variant of an existing color, just lower all R,G, B values proportionally. For example, to darken the magenta color (1.0, 0.0, 1.0), multiply all components by say 0.5 and you get (0.5, 0.0, 0.5).

An good method for experimenting with color values is to just open the Windows color dialog and see the effect of changing one ore multiple values. Also, experiment with different color systems, like HSI and see how they relate to each other.


以下逻辑可用于获取特定颜色的暗色版本。



fNewColorR = fColorR * fIntensity;

fNewColorG = fColorG * fIntensity;

fNewColorB = fColorB * fIntensity;



通过减小fIntensity的值可以实现特定颜色的深色版本。
The following logic can be used to get the dark version of a particular color.

fNewColorR = fColorR * fIntensity;
fNewColorG = fColorG * fIntensity;
fNewColorB = fColorB * fIntensity;

Dark version of a particular color can be achieved by a decreasing the value of fIntensity.


这篇关于如何在opengl中混合颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆