Docsity

Open GL and GLUT Example Program on Computer Graphics - Study Guide | CSC 562, Study notes of Computer Graphics

Toggle sidebar
bg1
1
OpenGL/GLUT Example Program
CSC 462: Advanced Undergraduate Computer Graphics
CSC 562: Introduction to Graduate Computer Graphics
This document describes how to compile the example OpenGL program (available on the course web page) under Windows XP
and Visual Studio .NET. The example program displays a wireframe cube and an XYZ axis in a window. A popup menu allows
you to translate the cube about the X and Y axes, and rotate the cube about the X, Y, and Z axes. Once a transformation mode
is chosen, hold down the left mouse button while moving the mouse left, right, up, and down to transform the cube.
You should be able to use this program as a template for designing your own assignments and projects. For a complete descrip-
tion of the OpenGL and GLUT APIs, see the reference manuals:
• OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 1.4 by Shreiner, Woo, Neider, and Davis
(4th edition, Addison-Wesley)
• OpenGL Reference Manual (3rd edition, Addison-Wesley)
• The OpenGL Utility ToolKit1 (GLUT) Programming Interface API by Kilgard
When you begin a new project in Visual Studio .NET (our standard programming environment), you will need to perform the
following steps to ensure your program can find and use the OpenGL and GLUT APIs:
1. In the File→New→Project... dialog, under the Visual C++ Projects option, choose Win32 Project from the list of available
project types. Select a project name and location in the Name: and Location: input fields.
2. Select the Application Settings tab in the Win32 Application Wizard dialog, choose Console Application, select Empty
project, and click Finish.
3. In the Project→Properties dialog, in the Linker folder, select the Command Line option and add opengl32.lib, glu32.lib,
and glut32.lib to the Additional Options: input field.
4. In the Tools→Options... dialog, in the Projects folder, select the VC++ Directories option. Select Include files from the
Show directories for: popup menu, and add the path for the GLUT include file glut.h (normally, this path should be C:
\Develop\glut; you can use Window’s Find command to confirm this).
5. In the same dialog, select Library files from the Show directories for: popup menu, and add a path for the GLUT library
file glut32.lib (normally, this path should be C:\Develop\glut).
The source code for the example program can be downloaded from the course web page. You are encouraged to copy it onto a
machine in the Multimedia Lab, then compile and link it to make sure you can get an OpenGL/GLUT program running. You can
also modify the program, to see how different OpenGL commands affect the appearance of the cube (for example, try switching
from perspective projection to orthographic projection, and note how the display of the cube changes when you translate and
rotate it).
1. http://pyopengl.sourceforge.net/documentation/manual/reference-GLUT.html

Partial preview of the text

Download Open GL and GLUT Example Program on Computer Graphics - Study Guide | CSC 562 and more Study notes Computer Graphics in PDF only on Docsity!

OpenGL/GLUT Example Program

CSC 462: Advanced Undergraduate Computer Graphics CSC 562: Introduction to Graduate Computer Graphics

This document describes how to compile the example OpenGL program (available on the course web page) under Windows XP and Visual Studio .NET. The example program displays a wireframe cube and an XYZ axis in a window. A popup menu allows you to translate the cube about the X and Y axes, and rotate the cube about the X, Y, and Z axes. Once a transformation mode is chosen, hold down the left mouse button while moving the mouse left, right, up, and down to transform the cube.

You should be able to use this program as a template for designing your own assignments and projects. For a complete descrip- tion of the OpenGL and GLUT APIs, see the reference manuals:

  • OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 1.4 by Shreiner, Woo, Neider, and Davis (4th edition, Addison-Wesley)
  • OpenGL Reference Manual (3rd edition, Addison-Wesley)
  • The OpenGL Utility ToolKit^1 (GLUT) Programming Interface API by Kilgard

When you begin a new project in Visual Studio .NET (our standard programming environment), you will need to perform the following steps to ensure your program can find and use the OpenGL and GLUT APIs:

  1. In the File→New→Project... dialog, under the Visual C++ Projects option, choose Win32 Project from the list of available project types. Select a project name and location in the Name: and Location: input fields.
  2. Select the Application Settings tab in the Win32 Application Wizard dialog, choose Console Application, select Empty project, and click Finish.
  3. In the Project→Properties dialog, in the Linker folder, select the Command Line option and add opengl32.lib, glu32.lib, and glut32.lib to the Additional Options: input field.
  4. In the Tools→Options... dialog, in the Projects folder, select the VC++ Directories option. Select Include files from the Show directories for: popup menu, and add the path for the GLUT include file glut.h (normally, this path should be C: \Develop\glut; you can use Window’s Find command to confirm this).
  5. In the same dialog, select Library files from the Show directories for: popup menu, and add a path for the GLUT library file glut32.lib (normally, this path should be C:\Develop\glut).

The source code for the example program can be downloaded from the course web page. You are encouraged to copy it onto a machine in the Multimedia Lab, then compile and link it to make sure you can get an OpenGL/GLUT program running. You can also modify the program, to see how different OpenGL commands affect the appearance of the cube (for example, try switching from perspective projection to orthographic projection, and note how the display of the cube changes when you translate and rotate it).

  1. http://pyopengl.sourceforge.net/documentation/manual/reference-GLUT.html