Skip to content

Commit dc98024

Browse files
authored
Removed Unnecessary bindBuffer call
bindBuffer has already been called once at line 79 ```js gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); ``` so calling it again with ```js gl.bindBuffer(gl.ARRAY_BUFFER, buffers.position); ``` does nothing.
1 parent cdfd2ae commit dc98024

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

webgl-examples/tutorial/sample2/webgl-demo.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ function main() {
5555

5656
// Here's where we call the routine that builds all the
5757
// objects we'll be drawing.
58-
const buffers = initBuffers(gl);
58+
initBuffers(gl);
5959

6060
// Draw the scene
61-
drawScene(gl, programInfo, buffers);
61+
drawScene(gl, programInfo);
6262
}
6363

6464
//
@@ -94,16 +94,12 @@ function initBuffers(gl) {
9494
gl.bufferData(gl.ARRAY_BUFFER,
9595
new Float32Array(positions),
9696
gl.STATIC_DRAW);
97-
98-
return {
99-
position: positionBuffer,
100-
};
10197
}
10298

10399
//
104100
// Draw the scene.
105101
//
106-
function drawScene(gl, programInfo, buffers) {
102+
function drawScene(gl, programInfo) {
107103
gl.clearColor(0.0, 0.0, 0.0, 1.0); // Clear to black, fully opaque
108104
gl.clearDepth(1.0); // Clear everything
109105
gl.enable(gl.DEPTH_TEST); // Enable depth testing
@@ -153,7 +149,6 @@ function drawScene(gl, programInfo, buffers) {
153149
const normalize = false;
154150
const stride = 0;
155151
const offset = 0;
156-
gl.bindBuffer(gl.ARRAY_BUFFER, buffers.position);
157152
gl.vertexAttribPointer(
158153
programInfo.attribLocations.vertexPosition,
159154
numComponents,

0 commit comments

Comments
 (0)