OpenGL #1

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.

  1. What is the initial size of the display window?
  2. 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)
  3. Comment out the gluPerspective call in display, and replace it with glOrtho(-2, 2, -2, 2, 0.1, 500);. What changes when you run your code?
  4. glutDisplayFunc is a very important callback function. Whenever GLUT determines that the contents of the window need to be redisplayed, the callback function registered by glutDisplayFunc is executed. What is the name of this function in our code, and what does it do?
  5. Move the first line of code in main, std::cout << "Hello, World!\n"; into the idle function and run your code. Describe what happens and explain when the idle function runs in your code.
  6. Comment out the last line in the idle function and run your code. What happens? Why?

Code

Using Cube3D as a guide, create an OpenGl program that:

  1. Has multiple shapes and colors.
  2. Has at least one new keyboard command, in addition to ‘esc’.
  3. 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:

  1. netid.pdf with answers to the above questions and a brief description of your code
  2. your .cpp file for your OpenGL code
  3. 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.