CSE 781 Lab1
CSE 781 Lab1
Assigned: January 15, 2010
Due: January 29, 2010 11:59 PM
Lab overview: Write an OpenGL program to render PLY models with virtual trackball interface
Objective: Upon finishing this lab, you know how to use OpenGL to render 3D models with basic lighting options. You will learn how to use OpenGL’s Vertex Buffer Object (VBO) to draw geometry. Finally, you will gain deeper understanding in OpenGL transformation by implementing the virtual trackball interface.
Tasks:
1. (5%) Write an OpenGL renderer that will take a PLY polygonal model as input and display the model in three-dimensional space. The renderer should contain the following features:
a. The program should take the name of the ply model as the input argument
You can find some PLY models in this link. Besides the models, on the web site
you will also download many useful tools and sample programs that will help you read the
PLY files. There are many useful filter programs for tasks such as generating or flipping normals for the models,
or create some simple PLY files such as spheres. Try to spend some time browsing the readme files and the
sample code.
b.To draw the model, you are required to use the Vertex Buffer Object (VBO). VBO is the recommended mechanism to draw geometry since the geometry will be cached on the server side (the graphics card) so higher efficiency can be achieved.
c.Your renderer should support smooth shading with at least one light source, and be able to switch between wireframe and filled polygon rendering mode. Use key stroke ‘w’ to toggle the wireframe mode. Note that not all PLY models you download will include vertex normals. Fortunately, you can use the filter (normalsply) downloaded from the ply page to generate normals and write the result out to a new PLY file. Sometimes it may be necessary to flip the normals for the models, which can be done by another filter (flipply) from the above web site.
d.Scale the model proportionally so that its size along the largest dimension is 1.0. Place the center of the model at the world origin (0,0,0).
e.Draw a large rectangle underneath your model as the floor. Also use GLUT to place a few objects such as Cubes and Spheres around your ply model.
2.(5%) Implement the virtual trackball interface to rotate the scene and/or the ply model:
a.Attach a global virtual trackball to the entire scene so that you can rotate the ply model, the floor, and everything else together.
b.Attach a local virtual trackball to the ply model
c.Use key stroke ‘g’ to toggle between the global and local trackball. Draw a sphere in wireframe mode to show the virtual trackball that is being manipulated. The sphere should be just big enough to enclose the scene/model.
d.Use the left mouse button to control the rotation with the virtual trackball interface
e.Use the right mouse button to scale your scene or ply model. When this happens, remember the virtual trackball you show should also become larger.
Lab submission
Submit your source code (.C and .h), and Visual Studio project file or Makefile (if you have any). Do not submit any executables or object files.
Submit a readme file to tell us what have been submitted, where your program was compiled and tested on (windows, linux, or mac machines), and how to compile and run your program. Also, tell us what ply models you have tested with your program. If the ply model is not on the PLY web site, tell us where to get the model.
Use the following command on stdsun to submit your lab:
> submit c781aa lab1 <names of all your files>
Notes about the submit program
The 'submit' program submits all of the files at once, not one at a time, previous submissions for a given lab are completely removed. Or put another way; each time the submit command is issued for a given lab, ALL of the previously submitted files are clobbered.
That means that
> submit c781aa lab1 lab1.c
> submit c781aa lab1 readme
will result in ONLY 'readme' remaining in the lab1 submission
You should do the following:
> submit c781aa lab1 lab1.c lab1.h .... readme
or
> submit c781aa lab1 lab1_dir
Where 'lab1_dir' is a directory containing all of the lab1 files to be submitted, or best of all (for both student and grader) is:
> cd lab1_dir
> submit c7811aa lab1 .
Submit will immediately print submission information to the submitter. Use 'man submit' if you have any other questions.
Late Penalty
You should submit your lab on time. We are on a quarter schedule, which is pretty tight. Being late for one lab could affect the time left for you to complete subsequent labs. All labs are due at 11:59 pm. of the specified due data, and there is a 10% penalty each day for up to 50%. After that, you get zero.
Grading Criteria
Grading of the labs will be based on the following:
• 90%: Correctness and adherence to assignment specification.
• 10%: Readability, structure of code, use of comments, adherence to lab procedures (submitting, naming conventions, etc.)
The grader will grade the labs. If you have problems with the grade you received on your lab, see the grader first. If you can't resolve the dispute with the grader, then see me. However, in order to maintain consistent grading for everyone in the class, I am not very inclined to alter grades that are assigned by the grader.
Don't copy labs. Discussion of lab assignments is allowed and encouraged. However, you need to complete the lab all by yourself. Labs which are too similar will be handed over to the Committee on Academic Misconduct and handled by them.
Last updated: 1/14/2010 Han-Wei Shen