This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, September 4.
This assignment and your next assignment are about the data structures used at the two ends of the 3D graphics rendering pipeline; what goes into the beginning of the pipeline and what comes out of the end of the pipeline. Roughly, what goes into the pipeline is the Scene
data structure which describes the geometry of what the renderer should draw. What comes out of the pipeline is the FrameBuffer
data structure which holds the image of the scene drawn by the renderer. This assignment is about what comes out of the graphics pipeline, the FrameBuffer
data structure. Assignment 2 will be about what goes into the rendering pipeline, the Scene
data structure.
A FrameBuffer
object holds an array of pixel data that represents an image that can be displayed on a computer's screen. For each pixel in the image, the FrameBuffer's array holds three byte values, one byte that represents the red component of the pixel's color, one byte that represents the green component, and one byte that represents the blue component of the pixel's color. Each of these three bytes is only eight bits in size, so each of the three colors has only 256 shades (but there are 256^3 = 16,777,216 distinct colors). If a framebuffer has dimensions n
rows of pixels by m
columns of pixels, then the framebuffer's array holds n*m
integers and each integer holds the three bytes for one pixel (with one unused byte in each integer). The pixel data is NOT stored as a "two-dimensional" (or "three-dimensional") array. It is stored as a one-dimensional array of length n*m
. This array is in "row major" form, meaning that the first m
integers in the array are the pixels from the image's first row. The next m
integers are the pixels from the images second row, etc. Finally, the first row of the pixels is the top row of the image as its displayed on the computer's screen.
In this assignment you are to write a program that creates a FrameBuffer
object and then fills it with pixel data so that the resulting image looks like the file Hw_1_demo.ppm
from the zip file. In the zip file there is a file Hw_1.java
that you need to complete. In Hw_1.java
there is a brief outline of what you need to do. You should make as much use of the FrameBuffer
interface as possible when you write your code. To learn about the FrameBuffer
class's interface, look at its source code in the framebuffer
sub folder of the zip file (you can also look at the Javadoc html file for the FrameBuffer
class). Your program should produce a result that looks exactly like Hw_1_demo.ppm
. There are a number of facts about the image in Hw_1_demo.ppm
that you need to find out (like, what are the exact colors?). Use tools from pixel-utilities.zip to determine these details about Hw_1_demo.ppm
.
Turn in a zip file called CS455Hw1Surname.zip
(where Surname
is your last name) containing your version of Hw_1.java
.
This assignment is due Tuesday, September 4.