Difference between revisions of "Project4Fall13"
(→1. OpenGL Lighting and Shading (50 points)) |
(→1. OpenGL Lighting and Shading (50 points)) |
||
Line 11: | Line 11: | ||
Start by reviving your application from assignment 2: you will need to be able to load each of the five 3D models into your application and display them at reasonable sizes, so that they are about screen filling. The function keys should switch between the models. | Start by reviving your application from assignment 2: you will need to be able to load each of the five 3D models into your application and display them at reasonable sizes, so that they are about screen filling. The function keys should switch between the models. | ||
− | You are welcome but not required to support the keyboard commands from assignment 2 to move around the models. However, you will need to add mouse control, which will allow rotating the model about the center of your OpenGL window, as well as scaling the model up and down. The left mouse button should be used for rotation, the right mouse button should scale. [[Media:cube.mpg|This video]] shows how the trackball-like rotation should work. We provide [[Media:trackball-code.txt|sample code for the trackball rotation.]] You will need to adapt it to the syntax of your matrix and vector classes and get it to work within your application. To access the mouse x and y coordinates, you will need to use GLUT's callback functions [http://www.opengl.org/resources/libraries/glut/spec3/node50.html glutMouseFunc()] and [http://www.opengl.org/resources/libraries/glut/spec3/node51.html glutMotionFunc()]. Note that successive trackball rotations must build on previous ones; at no point should the model snap back to a previous or default position. | + | You are welcome but not required to support the keyboard commands from assignment 2 to move around the models. However, you will need to add mouse control, which will allow rotating the model about the center of your OpenGL window, as well as scaling the model up and down. The left mouse button should be used for rotation, the right mouse button should scale. [[Media:cube.mpg|This video]] shows how the trackball-like rotation should work. We provide [[Media:trackball-code.txt|sample code for the trackball rotation.]] You will need to adapt it to the syntax of your matrix and vector classes and get it to work within your application. To access the mouse x and y coordinates, you will need to use GLUT's callback functions [http://www.opengl.org/resources/libraries/glut/spec3/node50.html glutMouseFunc()], which gets called when you press a mouse button, and [http://www.opengl.org/resources/libraries/glut/spec3/node51.html glutMotionFunc()], which gets called constantly while you hold the button down and move the mouse. Note that successive trackball rotations must build on previous ones; at no point should the model snap back to a previous or default position. |
<!-- | <!-- |
Revision as of 01:00, 20 October 2013
Project 4: Light and Shade
This project is on OpenGL lighting and shading, and includes GLSL shader programs.
This project is due on Friday, November 1st at 1:30pm. It will be discussed in Center Hall 105 on Monday, October 28th at 3:00pm.
Note that GLSL shaders, which are needed for part 2 of the assignment, will be covered in class on Tuesday, October 22nd.
1. OpenGL Lighting and Shading (50 points)
Start by reviving your application from assignment 2: you will need to be able to load each of the five 3D models into your application and display them at reasonable sizes, so that they are about screen filling. The function keys should switch between the models.
You are welcome but not required to support the keyboard commands from assignment 2 to move around the models. However, you will need to add mouse control, which will allow rotating the model about the center of your OpenGL window, as well as scaling the model up and down. The left mouse button should be used for rotation, the right mouse button should scale. This video shows how the trackball-like rotation should work. We provide sample code for the trackball rotation. You will need to adapt it to the syntax of your matrix and vector classes and get it to work within your application. To access the mouse x and y coordinates, you will need to use GLUT's callback functions glutMouseFunc(), which gets called when you press a mouse button, and glutMotionFunc(), which gets called constantly while you hold the button down and move the mouse. Note that successive trackball rotations must build on previous ones; at no point should the model snap back to a previous or default position.