Big Pixel Project

ECS 175
Big Pixel Project
Due 11:30 PM Tues April 13

Basic Assignment

This project is intended to introduce rasterization, the RGB color model, and the concept of linear interpolation.

Here are some C functions which implement a software framebuffer, consisting of a 50x50 array of pixels. To make the pixels easy to see, they are drawn as little squares (or "big pixels"). To color a pixel, you should call the function colorPixel.

  • bigPix.c
  • lowlevel.c
  • lowlevel.h
  • Makefile

    The basic project (worth 85 points) is to use the colorPixel function to draw a rasterized version of any trapezoid with horizontal top and bottom sides. Your trapezoid drawings should consist entirely of big pixels, drawn by calling colorPixel. Your function should take the vertices of the trapezoid as floating-point inputs, and also four colors, one for each vertex of the trapezoid. The colors should be linearly interpolated up the sides of the trapezoid, and then across each row. You should interpolate the colors of the endpoints of the left and right edges of the trapezoid to get the endpoint colors at each row, and then interpolate the colors along the row.

    To show that your function works, draw several trapezoids with different shapes and interpolated colors. You might want to try to make a picture or a pleasing pattern.

    You may NOT use OpenGL calls which draw polygons to draw the trapezoid. You may NOT use the sqrt function, or any other function from the math library; they all take a long time and are avoided in time-critical graphics functions.

    To get started, download the four files above into a directory on one of the machines in Kemper 67, and type "make". You should get an executable called bigPix. Typing "bigPix" will run it, bringing up a window with a gray square (the framebuffer) with one pixel colored red in the middle. Find the function drawContents. Right now it just draws one red pixel. Write your trapezoid drawing function, and then call it from drawContents.

    You can convert the code to C++ if you want; the Makefile should work for C++ as well.

    Note: Sometimes people have problems with the Makefile when they download it to Windows and then transfer it to the Linux machines. This can replace the TAB characters with spaces, which unfortunately ruins the Makefile (very silly Makefile syntax, where TAB has meaning! ugh!). Try downloading the Makefile straight from the browser.

    Additional Features

    Here are some ideas for ways to extend the basic project. Other ideas are welcome; check with me or the TA to make sure they are appropriate. Only very exceptionaly projects will get more than 100 points total.

    Turning in the project

    Turn in the project using the handin script (this is explained on the TA's Web page). Hand in your source code, a Makefile for the Linux machines in 67 Kemper, an executable that runs on the machines in 67 Kemper, an input image file if you used one, and a brief text file explaining how to run your program and what you implemented. Make sure your name appears on all of the source files and prominently in the text file.