Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

13
Computer Graphics Lab 1 OpenGL 1

Transcript of Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

Page 1: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

Computer Graphics

Lab 1

OpenGL

1

Page 2: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

What is OpenGL?

2

Page 3: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

What is OpenGL?

• OpenGL is a software interface to graphics

hardware. You can use to specify the objects

and operations needed to produce interactive

three-dimensional applications

• OpenGL is designed as a hardware-independent interface to be implemented on many different hardware platforms.

3

Page 4: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

OpenGL

• The most popular raster graphics library, providing a powerful but primitive set of rendering commands

• Already supported by every window systems• OpenGL Utility Library (GLU) : higher-level routines, part

of OpenGL implementationSetting up matrices for specific viewing orientations

and projectionsPerforming polygon tessellation and rendering

surfaces• OpenGL Utility Toolkit (GLUT): window –system-

independent high-level library. Need to install this library separately.

4

Page 5: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

OpenGL

• Install OpenGL Utility Toolkit (GLUT) for MS Windows Download GLUT from

http://reality.sgi.com/opengl/glut3/glut3.html Unzip the package Set “include directory” and “lib directory” in the C++ Compiler to

include the directory containing glut.h, glut.lib Copy glut32.dll into directory

DRIVE:\WINNT\SYSTEM

• Add #include <glut.h> to the beginning of the program

5

Page 6: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

OpenGL

• OpenGL Programming Guide: http://www.cs.ucf.edu/dsg/dtran/teaching/cps5

60/openGL/install/theredbook.zip

• Nate Robins’ OpenGL Tutorshttp://www.cs.utah.edu/~narobins/opengl.html

6

Page 7: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

If you are using a PC, OpenGL is included with all versions of Windows. You will have to get GLUT from the web. For windows you can download just the dll, lib and .h files. You should find OpenGL32.dll and glu32.dll with your system files. You should find the corresponding lib and .h files supplied with your compiler. The corresponding GLUT files should be placed with them.

7

Page 8: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

OpenGL

how to install the glut libraries and dll's ?

• glut.dll

• glut32.dll

• glut.h

• glut.lib

• glut32.lib

8

Page 9: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

• Files: .h, .lib, .dll– The entire folder gl is placed in the Include

directory of Visual C++– The individual lib files are placed in the lib

directory of Visual C++– The individual dll files are placed in C:\

Windows\System32

9

Page 10: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

1. Copy both glut.dll and glut32.dll into your windows directory (WINDOWS , or WINDOWS \System32)

2. Copy your glut.h to:<drive>:\<VC++ path>\include\GL\glut.h

*** put the drive where you installed VC++ instead of the <drive> ***

*** put the directory where you installed VC++ instead of the <VC++ path>

3. Copy your glut.lib and glut32.lib to:<drive>:\<VC++ path>\lib\glut.lib

<drive>:\<VC++ path>\lib\glut32.lib 10

Page 11: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

how to setup VC++ so that you can use the glut libraries?1. Start VC++ and create a new project.

2. The project has to be a "Win32 Console Application"

3. Type in the name of the project and where it will be on your hard drive.

4. Chose an empty project and click next or finish

5. First thing you need to do when the project opens up is to click on the "Project" menu item from the top.

6. Chose "Settings" (a window will come up)

7. On the left side of the window there are tabs, chose the "Link" tab

8. The string field labeled "Object/library modules" has a few lib files already set in it

9. Go to the end of this string field and enter: opengl32.lib glut32.lib glu32.lib

10. Chose "OK" and that will include all the opengl libraries that you need

11. Now all you need to do is include <gl\glut.h> and you are ready to go

11

Page 12: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

12

Page 13: Computer Graphics Lab 1 OpenGL 1. What is OpenGL? 2.

Example

13