gpt4 book ai didi

c++ - 混合添加颜色而不是仅仅替换?

转载 作者:行者123 更新时间:2023-11-28 03:28:03 25 4
gpt4 key购买 nike

有没有办法在绘图时在像素上添加颜色值(而不是设置)?

例如我的伪代码:

//DrawPixel( int x, int y, Color color ); - Puts pixel to color buffer with specific place.
DrawPixel( 0, 0, Red );
DrawPixel( 0, 0, Green );

在我执行这段代码后,0,0 像素的颜色是 Red+Green 的结果。 (黄色的)我不仅仅谈论绘制像素或混合。在 OpenGL 中有没有办法做到这一点?

最佳答案

是的。它叫做 GL_FUNC_ADD。除了透明度之外,还有一些其他有用的 blending functions​ .

在早期的 opengl 版本中Gl.BlendFunc(Gl.SRC_COLOR,Gl.DST_COLOR) 可能就可以解决问题。

关于c++ - 混合添加颜色而不是仅仅替换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13406548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com