gl_PointSize WebGL 中的零

gl_PointSize zero in WebGL

我有一个设置 gl_PointSize = mix( 0. , 5. , step(foo,bar) ); 的顶点着色器。我的 mac 使用 Intel HD Graphics 5000,只渲染 5 的点,而不是 0。另一个带有某种 radeon 的 mac 将零渲染为一个。

我通读了 gl_PointSize,但不明白 gl_PointSize = 0.; 需要的行为是什么,也不明白关于别名和舍入的部分。

如果我想 "hide" 某些点,我应该依靠 gl_PointSize = 0.; 甚至不光栅化这些点,还是应该使用其他东西?

想到两件事:

//frag

...
if( vSomeVarying < 0.5 ) discard; //but why even rasterize, and this is still like rendering all the points regardless of the discard?
...


//vert

if( someValue < 0.5 ){

  gl_Position.z = 2.; //should clip it?

}

If I want to "hide" certain points, should I rely on gl_PointSize = 0.; to not even rasterize the points, or should i use something else?

使用其他东西,因为在 p51 的 GLES 2.0.25 中:

If the value written to gl_PointSize is less than or equal to zero, results are undefined.

强制剪裁顶点有效。