OpenGL


About OpenGL

OpenGL is the environment for developing portable, interactive 2D and 3D graphics applications. OpenGL is the industry’s most widely used and supported 2D and 3D graphics application programming interface (API). OpenGL fosters innovation and speeds application development by incorporating a broad set of rendering, texture mapping, special effects, and other powerful visualization functions.

Advantages

  • Usability: OpenGL drivers encapsulate information about the underlying hardware, freeing the application developer from having to design for specific hardware features.
  • Stability & Compatibility: OpenGL implementations are available on a wide variety of platforms. Backward compatibility requirements ensure that existing applications do not become obsolete.
  • Industry standard:  The OpenGL Architecture Review Board, guides the OpenGL specification. With broad industry support, OpenGL is the only truly open, vendor-neutral, multiplatform graphics standard.
  • Reliable and portable: OpenGL applications produce consistent visual display results on any OpenGL API-compliant hardware, regardless of operating system or windowing system.
  • Support: OpenGL supports new hardware innovations to be accessible through the API via the OpenGL extension mechanism letting application developers and hardware vendors incorporate new features into their products.
  • Scalable: OpenGL applications can scale to any class of machine that the developer chooses to target.

Supported Platforms: 

  • All UNIX® workstations.
  • All Windows 95/98/2000/NT.
  • MacOS PC.
  • OPENStep.
  • BeOS.
  • Major windowing system like Win32, MacOS, Presentation Manager, and X-Window System.
  • Callable from Ada, C, C++, Fortran, Python, Perl and Java.

SetUp OpenGl development Environment

Windows: On Windows 95, 98, NT system, or 2000

  1. Install Microsoft Visual C++ (Default installation directory is c:\msdev)
  2. Install OpenGL and Glut: Create a temporary directory and extract the glutdlls.zip there. Copy all *.h files to c:\msdev\include\gl;  all *.lib files to c:\msdev\lib; and all *.dll files to c:\windows\system32.
  3. Set OpenGL or Glut in Visual C++: First, make sure that you’ve included all the necessary *.h files in your program. You need <GL/glut.h> for Glut; or <GL/gl.h> and <afxwin.h>, and possibly <GL/glu.h> and/or <GL/glaux.h> for OpenGL.
  4. Then choose Settings under the Project or Build menu item. The Settings button will appear after you compile your program once. OpenGLSetUpVC1
  5. A Project Settings dialog box will now pop up. You now need to select the Link tab. The Link tab may be hidden. Click the half-a-tab circled below: OpenGLSetUpVC2
  6. The Link page will appear as below: OpenGLSetUpVC3
  7. Goto the Object/library modules section field of this window add the following .lib files to the list. a) opengl32.lib b) glu32.lib c) glaux.lib d) glut32.lib
  8. Compile and run the sample programs.
  • OpenGL/Glut Configuration Tutorial On Visual Studio .NET
  1. Install OpenGL and Glut: Create a temporary directory and extract the glutdlls.zip there. Copy all *.h files to C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\gl\  (if gl directory does not exist, create one); Copy all *.lib files to C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib; and all *.dll files to c:\windows\system32.
  2. Start Visual Studio: Under the file menu select New Project. In the “New Project Window”, select “Visual C++ Projects” on the left hand side and select “Win32 console project” on the right hand side. Specify name and location of the project. In the “Win32 Application Wizard Window ”, select the “Application Settings; then click “Empty Project”.
  3. Right click on the “Source Files” folder (on the right); select “Add” ->“Add New Item” -> “C++ file”. Name the file, and copy the source code to this file.
  4. Press F5 to build and run your project.
  5. Optional: If you put your glut under C:/my/glut/; Point Visual Studio to the relevant GLUT files. Right click on your project name (on the right hand side) or pull down the Project menu. Select “Properties”  “C/C++” properties. Select “General”and add the following line to “Additional Include Directories” “C:/my/glut/include”. Select the “Linker” properties “General” and add the following line to “Additional Library Directories” “C:/my/glut/”.

Linux:

  • Prerequisites: If a GPU is employed, the drivers must be installed. The package to compile and run C/C++ source codes must be installed. Or just install the build-essential package which contains everything.
  • Install the latest versions of the following packages:
    • sudo apt-get install mesa-common-dev
    • sudo apt-get install freeglut3-dev  
    • Note: The above packages have been specified for Ubuntu platforms. Select appropriate packages for other Linux distros.
  • Compile and Execute the sample source codes provided using the following command:  g++ -lglut -lGL -lGLU -lGLEW -lm example.cpp -o examp

Leave a comment