This assignment makes use of the files contained in this zip file. This assignment is due Monday, April 4.
This assignment is based on the JOGL transformation examples that we used in class.
This assignment uses transformations on P, N, and W letters to create an animation. In the zip file there is an animation file, hw3.mp4
and an outline of a Java program Hw3.java
. You should complete the Java program so that it replicates the animation. For the P, N, and W letters, use the P.java
, N.java
, and W.java
files in the zip file. The P.java
file is completed for you. You need to complete the N.java
and W.java
files so that they draw the letters N and W.
In the zip file there is the image file PNW_triangulations.png
that shows you how to "triangulate" the letters. Every shape in OpenGL is made up of triangle primitives. For the N and W letters, you need to define the vertices and triangles each letter will be made of. Use P.java
and PNW_triangulations.png
to guide you. Each letter, like P.java
, should fit in the unit square with 0 <= x <= 1
and 0 <= y <= 1
. You can shade your letters any way you want. You don't have to make them have the same color as in hw3.mp4
. If you shade every triangle in your letters a different way, that can help you debug any misplaced vertices or improperly ordered triangles.
Here is the most important thing to remember for this assignment. If you want to rotate a model around the point (a,b,c)
in the model's coordinate system, and you want this rotation to happen at the point (u,v,w)
in the world coordinate system, then you would do that with the following three transformations.
gl.glTranslated(u, v, w); gl.glRotated(theta, _,_,_); // choose any axis gl.glTranslated(-a, -b, -c);
The animation is a loop that ends where it begins (the video file hw3.mp4
shows two iterations of the animation loop). Your program should be an infinite loop that continuously repeats the animation loop. The animation runs at a rate of one degree per frame with 30 frames per second. The three letters are, at the beginning of the animation loop, along side of each other on the x-axis with N
centered on the y-axis. Notice that the letter W
rotates around the middle of its top edge. Also notice that the letter N
rotates at different rates during the animation. The letter P
is rotating 90 degrees around each of the four corners of a unit square.
Turn in a zip file called CS51580Hw3Surname.zip
(where Surname
is your last name) containing your versions of Hw3.java
, N.java
, and W.java
.
This assignment is due Monday, April 4.