WebGL矩形边框

时间:2015-01-28 21:14:45

标签: canvas html5-canvas webgl

我尝试使用WebGL渲染带有实线边框的透明矩形。我知道如何通过在webGL的uniformfv()函数中将alpha设置为零来使其透明,但我无法弄清楚如何渲染实线边框并且没有找到任何有用的在线内容。请注意我需要使用WebGL,因此context2D函数(例如strokeStyle)可能不起作用。如果你知道怎么做,请告诉我。

由于

1 个答案:

答案 0 :(得分:1)

三角形基元不会给你这个......但是

中有一个gl.LINES
gl.drawElements(gl.LINES, given_animal.vertex_indices_buffer.numItems, gl.UNSIGNED_SHORT, 0);

因此,您可以在环绕每个三角形的顶点时定义线段。这个原语确实有线宽

的概念
gl.lineWidth(width);