Requirements:
• Write a WebGL program that creates and visualizes a random triangle. Name your source code hw1.html
and hw1.js. The program should meet the following requirements:
– Set the title of the program to “hw1” (must appear on title bar).
– Set the background color to black.
– Create triangle vertices at 3 random locations. Create random coordinates so that each vertex may
possibly be positioned anywhere within canvas, but never outside.
– Create and assign 3 random colors for the 3 vertices. These 3 colors must be linearly interpolated within
the triangle.
– Use drawArrays function to visualize the triangle on canvas.
– Thus, every time you hit F5 (refresh) key, the canvas must display a new random triangle at a random
position, with random size and random color gradient (see Fig. 1 ∼ 2). The triangle vertices must never
go out of bounds.
Figure 1: Random triangle 1
1
Figure 2: Random triangle 2
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw1.zip, then submit your hw1.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Requirements:
• Write a WebGL program that creates and visualizes random polygons (n-gons). Name your source code
hw2.html and hw2.js. The program should meet the following requirements:
– Set the title of the program to “hw2” (must appear as such on title bar).
– The program generates 20 random polygons at random positions with random colors (see Fig. 1).
– Each polygon must have a random number of vertices (between 3 and 9).
– Each polygon must continuously rotate and scale (see accompanying video on Canvas). Note that the
rotation must be done in-place about its own center, not about the origin. Hint: first translate the polygon
to the origin, then rotate, then translate it back to its original position.
– The scaling must go back and forth between scaling factors of 1 and 0 as upperbound and lowerbound,
respectively.
– Each time you hit F5 (refresh), the canvas must display a new set of 20 random polygons rotating and
scaling in-place (See Fig. 1 – 2).
Figure 1: Rotating and scaling polygons 1
1
Figure 2: Rotating and scaling polygons 2
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw2.zip, then submit your hw2.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Requirements:
• Write a WebGL program that creates symmetric sine wave animation. Name your source code hw3.html
and hw3.js. The program should meet the following requirements:
– Set the title of the program to “hw3” (must appear as such on title bar).
– Modify wave.js (m3.zip) so that the sine wave would be symmetric across y-axis (left half and right half
are like twins but moving in the opposite directions), as shown in Fig. 1.
– Also see the accompanying video. Your mission is to reproduce the program shown in the video.
Figure 1: Symmetric sine wave
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
• Make sure your library folder/files are in the right location relative to your main program (.html), such that
when your main program (.html) is clicked as is, it should run without problem.
1
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw3.zip, then submit your hw3.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Requirements:
• Write a WebGL program that does a simple image processing task. Name your source code hw4.html and
hw4.js. The program should meet the following requirements:
– The program displays an image and lets user adjust the hue. (Hint: you may first convert RGB color to
HSV color, then adjust the hue component).
– The image should be accessed through its URL address. Do not include an actual image file in your
submission.
– Implement dat.gui scroll bar widget so the user can adjust hue interactively (see Fig. 1).
– Also see the accompanying demo video. Your mission is to reproduce the program in the video.
– The slider value should range from −180 to 180. This is because hue is typically expressed by an angle
on color wheel, and the user-selected value represents how much the orignal pixel color shifts along the
color wheel in terms of degree angle. Note that since 180 degree angle is the same as −180 degree angle,
they should result in the same outputs.
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
• Make sure your library folder/files are in the right location relative to your main program (.html), such that
when your main program (.html) is clicked as is, it should run without problem.
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw4.zip, then submit your hw4.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
1
Figure 1: Interactive hue adjustment
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Requirements:
• Write a WebGL program that meets the following requirements. Name your source code hw5.html and
hw5.js.
– The program models a 3D cylinder and displays it using wireframe rendering (see Fig. 1).
– The model must consist of top face (n-gon), bottom face (n-gon), and side faces (rectangles).
– Each n-gon (top/bottom faces) must consist of n triangles in the form of triangle fan (see Fig. 1).
– Each of the side rectangles must consist of 2 triangles (see Fig. 1).
– The cylinder must be rotating constantly to show the model from various angles (see video).
Figure 1: WireCylinder
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
1
• Make sure your library folder/files are in the right location relative to your main program (.html), such that
when your main program (.html) is clicked as is, it should run without problem.
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw5.zip, then submit your hw5.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Requirements:
• Write a WebGL program that meets the following requirements. Name your source code hw6.html and
hw6.js.
– The program builds on Polyhedron GUI.js (see Fig. 1).
– See the accompanying video. Your program should basically look and work like the one in the video.
– Add a checkbox light? which, if checked, smoothly rotates light on top of the currently selected
object using y-roll (see video).
– If unchecked, the light stops rotating and stays right where it is now until it’s checked again (see video).
– All other GUI menu items should work the same as before (see video).
Figure 1: Rotating Light
1
What to submit:
• Submit all your source files (.html, .js) that are needed for compilation, including library files/folders. Missing library files/folders will lead to point deduction.
• Make sure your library folder/files are in the right location relative to your main program (.html), such that
when your main program (.html) is clicked as is, it should run without problem.
How to submit:
• Use Canvas Assignment Submission system to submit your source files.
• Make sure to zip all your files/folders into hw6.zip, then submit your hw6.zip as a single file.
Policy
• Do all the assignments on Chrome Development Tools using HTML, JavaScript, and GLSL ES.
• At the top of each source file, provide comments specifying the author, date, and a brief description of the file.
• Source code must contain enough comments here and there to make it easy enough to follow. Insufficient
comments could lead to point deduction.
• Incomplete program will get almost no credit (e.g., program does not run due to compile errors or program
terminates prematurely due to run-time errors).
• Thou shall not covet thy neighbor’s code. If identical (or nearly identical) submissions are found among
students, every student involved will get automatic zero for the assignment. The same goes for copying
existing code from online source.
• If a student makes multiple submissions, only the last submission will be considered valid.
Reviews
There are no reviews yet.