Pages

Tuesday, November 1, 2011

OpenGL and GLUT in Visual Studio 2010

Introduction
This is my first tutorial on OpenGL. Today I am going to show how to create a simple project on Microsoft Visual Studio 2010 on OpenGL.
First I am going to make some theoretical talking on OpenGL and GLUT. If you don't like it then skip it. I just copy this theory from references.


OpenGL


OpenGL, also known as the Open Graphics Library, is a library designed for cross platform 3D graphics. It is directly, the only competitor to Direct3D in the DirectX library. OpenGL is also hardware accelerated, just like Direct3D, and both of these libraries are the main focus for graphics card performance.

GLUT

So what about GLUT? GLUT (The OpenGL Utility), is a tool which allows the creation of windows and handling of input on multiple systems. Making OpenGL cross-platform and extremely simple to set up. Unfortunately, the original GLUT is no longer being developed, but don’t worry, there is a remake of GLUT called FreeGLUT, which even works with the original GLUT dll files and is exactly the same to use.

The original GLUT library seems to have been abandoned with the most recent version (3.7) dating back to August 1998. Its license does not allow anyone to distribute modified library code. This would be OK, if not for the fact that GLUT is getting old and really needs improvement. Also, GLUT's license is incompatible with some software distributions (e.g., XFree86).
freeglut was originally written by Pawel W. Olszta with contributions from Andreas Umbach and Steve Baker. Steve is now the official owner/maintainer of freeglut.


Step 1: Install Visual Studio 2010 

Step 2: Download required files

I download all files and merge them in same category so that it will be easy for installation.
To download all file Click here. In this file there are three folders name include, lib and system32 which means files of include folder must be copied to inlcude folder as instructed below in Step 3: Installation and so on.
In case you want to download from original site then they are given below, from where I collected them.

Step 3. Installation

  1. Put the Header files (*.h) in "C:\Program Files\Microsoft Visual Studio 10.0\VC\include\GL\"  Folder.
  2. Put the Library files (*.lib) in "C:\Program Files\Microsoft Visual Studio 10.0\VC\lib" Folder.
  3. Put the Dynamic Link Library files (*.dll) in "C:\Windows\System32\" Folder.
If everything is okey then I think you are done with the installation.


Step 4. Create project on VS2010

Step 1 :    Open Visual Studio 2010

Step 2 :   Create New Project.
                                                      Select File > New > Project
Create New Project 1
    Step 3 :   From Left select Visual C++ as language and then from there select Win32 and then Win32 Console Application as following figure. And then give a name of the project. And at last Click on OK.
 
Select Win32 Console and provide a name


 Step 4 : A new window will open Click next


Click Next
 
Step 4 : Check Empty Project and then click Finish.  You are done with project Creation.


Step 5 :   Now Add source file. From Solution Explorer (if not available the show it by selecting View > Solution Explorer Shortcut ( CTRL+W,S )  ) Right Click on Source Files And 
Select Add > New Item as following figure


A new window will open. From there select C++ File  and provide file name and Click Add.


Now type your source code and run your program.

Some people says that you need to do some change in project properties (configuration manager). In my PC  without making that change it runs well. If you face any problem let me know. I will add that portion.



References:
  1. http://freeglut.sourceforge.net
  2. http://www.swiftless.com/tutorials/opengl/window.html
  3. http://thoughtsfrommylife.com/article-748-OpenGL%5Fand%5FVisual%5FStudio%5FExpress%5F2008


Any kind of suggestion is appreciated.
Thanks.
Razib Chandra Deb.

4 comments:

Junaed said...

Good post,carry on :)

Siddiq Abu Bakkar said...

Excellent way of blogging. Keep it up brother.

Anonymous said...

Thank you .
continue...

Unknown said...

very useful and easy solution