Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+5 Should the WACC be used in all circumstances?

Answered: 1 week ago

Question

Define cognition, and describe the functions of concepts.

Answered: 1 week ago

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago