Get familiar with OpenGL
Open the 3D Cube program from class and answer the following questions based on the code. Your answers should be submitted as a pdf named netID.pdf, where netID is your netID. For example, I would submit tcp5.pdf.
Questions
Your code starts in main where your OpenGL program is initialized and set up.
- What is the initial size of the display window?
- The code enables you to change the size of the display window once the program is running. Try this. What line(s) of code enable you to resize the window, and what happens when you comment out this code? (If you can no longer see the cube you have commented out too much code)
- Comment out the
gluPerspectivecall indisplay, and replace it withglOrtho(-2, 2, -2, 2, 0.1, 500);. What changes when you run your code? glutDisplayFuncis a very important callback function. Whenever GLUT determines that the contents of the window need to be redisplayed, the callback function registered byglutDisplayFuncis executed. What is the name of this function in our code, and what does it do?- Move the first line of code in
main,std::cout << "Hello, World!\n";into theidlefunction and run your code. Describe what happens and explain when theidlefunction runs in your code. - Comment out the last line in the
idlefunction and run your code. What happens? Why?
Code
Using Cube3D as a guide, create an OpenGl program that:
- Has multiple shapes and colors.
- Has at least one new keyboard command, in addition to ‘esc’.
- At least one object moves.
Add a brief writeup to your netID.pdf file, from above, that explains what your code does and how to use your keyboard commands.
Submit
In your DropBox folder, create a new folder names OpenGL_1. Add to your DropBox folder:
- netid.pdf with answers to the above questions and a brief description of your code
- your .cpp file for your OpenGL code
- A screenshot of your running OpenGL project.
Grading
Questions: 12 points
Code (12 points)
| 4 (A) | Completes all criteria, is creative, shows extensive effort, clean code |
| 3 (B) | Completes criteria, but shows only basic effort |
| 2 (C) | Mostly there, but missing something |
| 1 (D) | You handed something in |
Basic score cut-offs multiplied by 3.