为什么在片段着色器中 gl_FragColor 的 alpha 参数低于 1 时对象看起来是灰色而不是透明的
why object is looking gray instead being transparent when alpha parameter of gl_FragColor is lower than 1 in fragment shader
当我将 gl_FragColor 的 alpha 值设置为 1 时,这就是结果。
但是,如果我将它设置为 0.5,这就是我所看到的,但没有任何透明的东西,这正常吗?
您是否在渲染器中启用了 alpha 混合?
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
当我将 gl_FragColor 的 alpha 值设置为 1 时,这就是结果。
但是,如果我将它设置为 0.5,这就是我所看到的,但没有任何透明的东西,这正常吗?
您是否在渲染器中启用了 alpha 混合?
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);