gpt4 book ai didi

WebGL 渲染抗锯齿

转载 作者:行者123 更新时间:2023-12-05 06:24:56 29 4
gpt4 key购买 nike

我正在将 webgl 与 javascript 结合使用。有没有办法在没有抗锯齿的情况下进行渲染?我需要每个像素都是纯色。

我目前的片段着色器非常简单:

precision mediump float;
varying highp vec3 lighting;

void main(void)
{
gl_FragColor = vec4(lighting, 1.0);
}

更新

根据@Moormanly 的回答,我通过在 getContext 中设置抗锯齿属性实现了以下效果:

默认别名:

alias=default

抗锯齿 = 假:

enter image description here

最佳答案

You can set attributes when creating a context using the ( optional ) second parameter of the getContext method.

Code:

var context = canvas.getContext('webgl', {antialias: false});

Check out chapter 5.2 of the WebGL specification for more information.

来自 forums.tigsource.com

关于WebGL 渲染抗锯齿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57438203/

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