Question: WebGL: Add code so that the Reset button clears all the points on the display. (reset button uses for both clears all the points display

WebGL: Add code so that the "Reset" button clears all the points on the display.

(reset button uses for both clears all the points display on the canvas, and also reset the position of color Sliders, but you do not need to change anything for color Sliders reset because it is done) So, just add code to clear canvas.

Code need to modify

// Set up the callback for the reset button resetButton.addEventListener("click", function () { for (var i in rgbSliders) { rgbSliders[i].value = rgbSliders[i].max / 2.0; rgbSliders[i].valueDisplay.textContent = rgbSliders[i].valueAsNumber / rgbSliders[i].max; } requestAnimationFrame(render); });

Something maybe help:

/** * Render - draw the frame * */ Lab2.prototype.Render = function () { var gl = this.gl; gl.clearColor(0.0, 0.0, 0.25, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.POINTS, 0, this.pointCount); };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!