ECE/CS 412/512 Introduction to Computer Graphics Assignment 2 The Graphics Pipeline
Total of Points of the Assignment: 17
Deadline Nov 5th (Monday), by end of the day
You have implemented a simple viewer for polygonal models using OpenGL in your first assignment. Your program could accept a triangle mesh file containing the description of the model and use OpenGL API to render the triangle mesh. By using the OpenGL fixed pipeline, your program supports a lot of features while rendering.
In this assignment, you will implement some important tasks to replace the work of a subset of the OpenGL fixed pipeline. In particular, your work should mimic the fixed OpenGL pipeline in the following tasks:
• Matrix manipulation: when you translate or rotate the camera along its own axis, you should calculate the model-view matrix by yourself. Also, when you do the vertex projection from CCS to image plane, you should implement your own projection matrix. It should be exactly the same as the matrix when you use gluLookat, glPerspective or glOrtho.
• Shader-based rendering: instead of using the OpenGL fixed rendering pipeline (so you should not use glVertex anymore), you are required to use GLSL to write your own vertex shader and fragment shader. In the vertex shader, you should write code for vertex position transformation by passing your own model-view and projection matrix. In the fragment shader, proper color should be set. There is one thing you should always keep in mind, when a shader is being used; the corresponding functionality of the fixed pipeline at this stage is disabled.
Goals
By successfully completing this assignment, you should feel more comfortable with concepts such as geometrical transformations, perspective projection, OpenGL pipeline and basic GLSL programming.
Assignment Description
Your viewer should provide the following features:
a) Create two windows: one is for fixed pipeline rendering (e.g. from your first assignment) and the other one is for shader-based rendering. (4 points)
b) Calculate the model-view and projection matrix by yourself. (4 points)
c) Write code for vertex position transformation by passing your own model-view and projection matrix to the vertex shader. (2 points)
d) Support translations and rotations of the virtual camera. Translations and rotations should be defined with respect to the coordinate system of the camera (CCS). (2 points)
e) Render the models using points, wireframe and solid representations. (1 points)
f) Reset the camera to its original position. (1 points)
g) Support for changing the values of the near and far clipping planes. (1 points)
h) Support for interactive change of colors (R, G, B) for the models, making sure that the color change is apparent under all rendering modes. (1 points)
i) Support for reading a new model file through the user interface. (1 points)
Note: All the rendering must be done using both fixed pipeline as from your first assignment and shader-based one and your code should be able to produce the same result at both windows.
Start to work on this assignment as early as possible. It might be harder than what you think. Good luck!