I am having a lot of confusion understanding why the commenting out gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT)
makes no difference to the result. in both cases my textues cube is drawn and rotated as expected. The only time this makes a difference is when I am drawing to a framebuffer. Can someone shed some light on this please?
gl.enable(gl.DEPTH_TEST);
gl.viewport(0,0,canvas.width,canvas.height);
gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);
gl.useProgram(cubeProgram);
gl.bindVertexArray(cubeVAO);
gl.uniformMatrix4fv(cubeProgram.MV,false,result);
gl.drawElements(gl.TRIANGLES, 36 , gl.UNSIGNED_SHORT, 0);
requestAnimationFrame(init_rotation);