Bilkent University

Department of Computer Engineering

CS465 – Computer Graphics I

Tutorial – 1 : Getting Started…

         In this short tutorial, you’ll learn how to configure your programming environment to compile and execute your very first OpenGL application.

1.    Preparations:

OpenGL applications you’ll be developing in this course require extensions that are introduced in OpenGL 3.2 version. Majority of the graphics cards in the market support OpenGL 3.2 version and above. However out-dated cards may not support this version. Therefore it is important that you check your graphics hardware first to make sure that it meets this requirement. A list of applicable cards is given below for different chipset manufacturers.

 

·       Nvidia

The new features in OpenGL 3.2 require hardware with G80 or newer core technology. Thus OpenGL 3.x is not supported on NV3x, NV4x nor G7x series hardware. This means you need one of the following NVIDIA graphics accelerators to use OpenGL 3.2:

Desktop

·         Quadro FX 370, 570, 1700, 3700, 4600, 4700x2, 4800, 5600, 5800, Quadro VX200, Quadro CX

·         GeForce 8000 series or higher; Geforce G100, GT120, 130, 220, GTS 150, GTS 250, GT310, 320, 330, 340, GeForce GTX 260 and higher, any ION based products.

Notebook

·         Quadro FX 360M, 370M, 570M, 770M, 1600M, 1700M, 2700M, 2800M, 3600M, 3700M, 3800M

·         GeForce 8000 series or higher

·       ATI Technologies

 

You can check whether your card supports OpenGL 3.x versions from AMD’s website (http://www.amd.com). Information on graphics hardware products are given in “Products and Technologies” link at the top of the page. Select “specifications” link provided for your graphics card and there you should see the OpenGL version.

 

Before proceeding make sure that your graphics hardware meets this specification. Course assignments will be done in pairs. So if you don’t possess an applicable card you may team up with a partner who does. In case you cannot find such a partner please notify your course assistant as soon as possible.

 

Fortunately, the code supplied in this tutorial does not use OpenGL 3.2 extensions (as it is just a simple “Hello World!” application). It uses only the core functionality. So you may proceed with this tutorial even if you don’t have an applicable graphics accelerator.

 

Before we proceed, make sure that you’ve downloaded the latest drivers for your graphics accelerator from the website of your chipset manufacturer (i.e. Nvidia or ATI).

 

2.    Configuration:

The code sample for VC++ 2005 can be downloaded from the “Sample Code” link provided in the “Resources” section of this document. Your first OpenGL application requires implicit linking of the following libraries:

OpenGL: As the name suggests this is the actual OpenGL library. The dynamic link library “OpenGL32.dll” should exist by default within the “/Windows/System32” folder for 32-bit machines. It exists in “/Windows/SysWOW64” folder for 64-bit machines. You also need the import library “OpenGL32.lib” to link it. You should find one copy within the VC++ 2005 installation directory (usually in “/<visual studio install directory>/VC/PlatformSDK/Lib” folder). Your VC++ 2005 should link the libraries that exist in “/PlatformSDK/lib” folder by default. So you won’t need to link them manually. If you need to link them manually however, you’ll need to specify the import libraries (“*.lib” files) as additional dependencies in the linker options of your project. 

 

GLU: GLU is the OpenGL Utility Library. It contains the functions starting with the “glu” prefix (in example “gluLookAt” function). Similar to OpenGL you should find the dynamically linked library “glu32.dll” in the “/Windows/System32” folder and the import library “glu32.lib” in your “/PlatformSDK/Lib” directory.

 

Freeglut: Freeglut is the I/O library we’ll be using. It initializes the rendering window and supports basic input/output operations. Please check “Resources” section of this document for download instructions. Extract the downloaded Freeglut package and copy the header (.h) files to “/<visual studio install directory>/VC /PlatformSDK/Include/gl” folder. Similarly copy the lib files to “/PlatformSDK/Lib” and dll files to “/Windows/System32”. If you have a 64-bit operating system, then copy the dlls to “/Windows/SysWOW64” folder instead of the “System32” folder.

 

GLEW: GLEW is the OpenGL Extensions Wrangler Library. It helps in querying and loading of the OpenGL extensions. Extensions are the additional functionality created by the OpenGL vendors (such as Nvidia) to make use of the newer graphics technology. Instructions on how to download GLEW is given in the “Resources” section of this document. Extract the contents of the GLEW package and copy them to the relevant directories (the same as Freeglut).

This concludes VC++ configuration. You should now be able to compile and run the sample code provided. Feel free to contact your assistant if you experience any problems.

1.    Output:

If you have done everything right and compiled the sample code. Then you should be seeing a screen similar to the one given in the below figure (Figure -1) after you execute the program.

Figure – 1: Output of your very first OpenGL application.

You should see the colored triangle rotating around itself.

2.    Resources:

·       Freeglut:

You can download the Freeglut precompiled binaries from the website given in the below link:

http://www.transmissionzero.co.uk/software/freeglut-devel/

If you are using Visual C++ development environment you need to download “MSVC” packages. If you are using MinGW compilers you can download the “MinGW” package. Keep in mind that if you are targeting for a 64-bit machine you can also download the 64 bit version of the Freeglut library. However 32-bit library will work perfectly fine even on a 64-bit machine. And it is actually better if you go for the 32-bit library as this tutorial was tested only with the 32-bit libraries.

·       Glew:

You can download the latest version of the Glew library (it was 1.7.0 when this tutorial was written) from the website given in the below link:

http://glew.sourceforge.net/

Once again you can use the win32 library even if you have a 64-bit machine. Hence the .zip file you’ll be downloading should have a name similar to glew-1.7.0-win32.zip.

·       Sample Code (Visual C++):

The sample code for this tutorial can be downloaded from the below link:

http://cs.bilkent.edu.tr/~akaydin/cs465/resources/CS465_Tutorial_1_VC8.rar

Extract and simply run the solution file (.sln). Afterwards you can compile and execute project if you have completed the steps in configuration section.