logo

Crowdly

The following shows an excerpt of a WebGL program. What should be in the blank? ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

The following shows an excerpt of a WebGL program. What should be in the blank?

var canvas = document.getElementById('my_Canvas');

gl = canvas.getContext('experimental-webgl');

var vertices = [

            -0.5,0.5,0.0,

            -0.5,-0.5,0.0,

             0.5,-0.5,0.0,

             0.5,0.5,0.0

];

indices = [3,2,1,3,1,0];

var vertex_buffer = gl.createBuffer();

gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);

gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);

var Index_Buffer = gl.createBuffer();

gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);

gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);

gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);

gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);

// Some other code

(_____________________________)(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT,0);

More questions like this

Want instant access to all verified answers on learn.twu.ca?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!