Time for action – enquiring on the state of buffers
Follow the given steps:
Open the file
ch2_StateMachine.html
in the HTML5 browser of your preference.Scroll down to the
initBuffers
method. You will see something similar to the following screenshot:Pay attention to how we use the methods discussed in this section to retrieve and display information about the current state of the buffers.
The information queried by the
initBuffer
function is shown at the bottom portion of the web page usingupdateInfo
(if you look closely atrunWebGLApp
code you will see thatupdateInfo
is called right after callinginitBuffers
).At the bottom of the web page (scroll down the web page if necessary), you will see the following result:
Now, open the same file (
ch2_StateMachine.html
) in a text editor.Cut the line:
gl.bindBuffer(gl.ARRAY_BUFFER,null);
and paste it right before the line:
coneIndexBuffer = gl.createBuffer();
What happens when you launch the page in your browser again?
Why do you think this behavior occurs...