gpt4 book ai didi

opengl - glBlendFunc 和 glClearColor alpha 参数

转载 作者:行者123 更新时间:2023-12-04 22:49:24 25 4
gpt4 key购买 nike

在 OpenGL 中,为了获得适当的透明度效果,我应该使用 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)但是使用该混合函数 glClearColor 中的 alpha 参数变得毫无意义。当我更改 glClearColor 中的 alpha 参数时我仍然得到同样的效果。我什么时候可以使用 glClearColor 中的 alpha 参数?能达到什么样的效果?

最佳答案

glClearColor设置颜色(和 alpha 值)RGBA 帧缓冲区将被清除为 glClear(GL_COLOR_BUFFER_BIT) . GL_DST_ALPHA 将考虑帧缓冲区 alpha 值或 GL_ONE_MINUS_DST_ALPHA混合功能。

但是,您的常规屏幕窗口帧缓冲区通常不带有 alpha 值。 Notable exceptions exist of course, for example transparent windows with the background shining through, but they're a bit tedious to set up, and will still receive all mouse events, even if over "transparent" areas.

具有 alpha channel 的帧缓冲区最受关注并渲染到纹理目标。

因此,在您的情况下,您对清晰的颜色没有特别的兴趣。您更有可能对 glColor4f 的第四个参数感兴趣。或带有 Alpha channel 的纹理。

关于opengl - glBlendFunc 和 glClearColor alpha 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11210607/

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