@@ -113,8 +113,9 @@ export class RectangleRenderer extends Disposable {
113113 gl . vertexAttribPointer ( VertexAttribLocations . UNIT_QUAD , 2 , this . _gl . FLOAT , false , 0 , 0 ) ;
114114
115115 // Setup the unit quad element array buffer, this points to indices in
116- // unitQuadVertices to allow is to draw 2 triangles from the vertices
117- const unitQuadElementIndices = new Uint8Array ( [ 0 , 1 , 3 , 0 , 2 , 3 ] ) ;
116+ // unitQuadVertices to allow is to draw 2 triangles from the vertices via a
117+ // triangle strip
118+ const unitQuadElementIndices = new Uint8Array ( [ 0 , 1 , 2 , 3 ] ) ;
118119 const elementIndicesBuffer = gl . createBuffer ( ) ;
119120 this . register ( toDisposable ( ( ) => gl . deleteBuffer ( elementIndicesBuffer ) ) ) ;
120121 gl . bindBuffer ( gl . ELEMENT_ARRAY_BUFFER , elementIndicesBuffer ) ;
@@ -153,7 +154,7 @@ export class RectangleRenderer extends Disposable {
153154 // Bind attributes buffer and draw
154155 gl . bindBuffer ( gl . ARRAY_BUFFER , this . _attributesBuffer ) ;
155156 gl . bufferData ( gl . ARRAY_BUFFER , this . _vertices . attributes , gl . DYNAMIC_DRAW ) ;
156- gl . drawElementsInstanced ( this . _gl . TRIANGLES , 6 , gl . UNSIGNED_BYTE , 0 , this . _vertices . count ) ;
157+ gl . drawElementsInstanced ( this . _gl . TRIANGLE_STRIP , 4 , gl . UNSIGNED_BYTE , 0 , this . _vertices . count ) ;
157158 }
158159
159160 public handleResize ( ) : void {
0 commit comments