抗锯齿的 VevGL 渲染

WebGL render antialias

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

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

precision mediump float;
varying highp vec3 lighting;

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

更新

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

默认别名:

抗锯齿 = 假:

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