Difference between revisions of "Project3SP15"
Line 21: | Line 21: | ||
Add a viewport matrix (D) to your code, and implement a method to create D based on the window size (<tt>window_width</tt> and <tt>window_height</tt>) and call it from the <tt>GLUT reshape</tt> function. Your program must correctly adjust projection and viewport matrix, as well as frame buffer size when the user changes the window size, just like in your previous assignment. | Add a viewport matrix (D) to your code, and implement a method to create D based on the window size (<tt>window_width</tt> and <tt>window_height</tt>) and call it from the <tt>GLUT reshape</tt> function. Your program must correctly adjust projection and viewport matrix, as well as frame buffer size when the user changes the window size, just like in your previous assignment. | ||
− | Then write a method to rasterize a vertex. You can use <tt>drawPoint</tt> from the base code to set the values in the frame buffer. Call this method from the draw callback (<tt>display</tt> function in base code) for every vertex in the 3D model. For this part of the assignment, create a method <tt>rasterizeVertex</tt> which projects each vertex of the house to image coordinates | + | Then write a method to rasterize a vertex. You can use <tt>drawPoint</tt> from the base code to set the values in the frame buffer. Call this method from the draw callback (<tt>display</tt> function in base code) for every vertex in the 3D model. For this part of the assignment, create a method <tt>rasterizeVertex</tt> which projects each vertex of the house to image coordinates. At this stage, render every point in bright white. |
<!-- | <!-- |
Revision as of 07:35, 11 April 2015
Contents |
Project 3: Software Rasterizer
In this project you will need to write your own software rasterizer. We provide some code that will allow you to integrate your rasterizer with OpenGL.
The project is due on Friday, April 17th, 2015 at 1pm. You need to present your results in the CSE basement labs as usual, grading starts at 12:15pm.
The homework discussion for this project will be on Monday, April 13th.
0. Getting started
Base Code
We provide base code for you which displays a software frame buffer on the screen. Your task is to rasterize your scene into this frame buffer. In this assignment you are not allowed to use any OpenGL calls which aren't already in the base code. Instead, use your vector and matrix classes from assignment #1 and add your own rasterization routines.
1. Rendering vertices
In the first step of building your own rasterizer you need to project the vertices of the 3D models from assignment 2 to the correct locations in the output image (frame buffer).
You should use the same model, camera and projection matrices as in assignment 2, so that you can use the rendering results from it to verify that your software rasterizer works correctly. We recommend that you start with your code from assignment 2 and copy-paste code from rasterizer.cpp where you need it. Support the 'e' key to switch between your rendering engines, OpenGL from the previous assignment and your new software rasterizer.
Add a viewport matrix (D) to your code, and implement a method to create D based on the window size (window_width and window_height) and call it from the GLUT reshape function. Your program must correctly adjust projection and viewport matrix, as well as frame buffer size when the user changes the window size, just like in your previous assignment.
Then write a method to rasterize a vertex. You can use drawPoint from the base code to set the values in the frame buffer. Call this method from the draw callback (display function in base code) for every vertex in the 3D model. For this part of the assignment, create a method rasterizeVertex which projects each vertex of the house to image coordinates. At this stage, render every point in bright white.