Difference between revisions of "Getting Started"

From OpenGL Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
=== Installing OpenGL ===
+
So you want to take advantage of the power of the OpenGL API? If you are visiting this page because a game or software implements the OpenGL API, you need to install the appropriate graphic driver which enables usage of the functionality provided.
So you want to take advantage of the OpenGL power ?
 
  
* to use a game or software that uses OpenGL, you need to install the appropriate graphic driver
+
To program using the OpenGL API, you need the driver and the development package (depends on platform and programming language). More platform-specific details are described in the sections below.
* to program using the OpenGL API, you need the driver and the development package (depends on platform and programming langage)
 
  
More platform-dependent details are described below.
+
__TOC__
  
==== Windows ====
+
== Windows ==
  
 
If you are running Windows 98/Me/NT/2000/XP/2003, the OpenGL library has already been installed on your system.
 
If you are running Windows 98/Me/NT/2000/XP/2003, the OpenGL library has already been installed on your system.
Win95A did not come with GL, so Microsoft has made this available
+
Win95A did not come with GL, so Microsoft has made this available at: [ftp://ftp.microsoft.com/softlib/mslfiles/opengl95.exe Windows OpenGL library].
[ftp://ftp.microsoft.com/softlib/mslfiles/opengl95.exe Windows OpenGL library]
+
 
 
Remember that GL is a system component on Windows. DO NOT modify or copy opengl32.dll from one OS to another.
 
Remember that GL is a system component on Windows. DO NOT modify or copy opengl32.dll from one OS to another.
The filename is opengl32.dll and is either in WINDOWS\SYSTEM, WINNT\SYSTEM32 or WINDOWS\SYSTEM32
+
The filename is <code>opengl32.dll</code> and is either in <code>WINDOWS\SYSTEM</code>, <code>WINNT\SYSTEM32</code> or <code>WINDOWS\SYSTEM32</code>. This also means that you do not have to ship a copy of the library with your application since it will already be available on the system.
  
This library alone will not give you hardware acceleration for OpenGL, though, so you will need to install the latest drivers for your graphics card:
+
The standard Windows <code>OpenGL32.dll</code> library alone will not provide you with hardware acceleration for OpenGL. In order to get hardware acceleration, you will need to install the latest drivers for your graphics card:
 
* [http://www.3dlabs.com 3Dlabs]
 
* [http://www.3dlabs.com 3Dlabs]
 
* [http://www.ati.com ATI]
 
* [http://www.ati.com ATI]
Line 25: Line 23:
 
* [http://www.guru3d.com Guru3D]
 
* [http://www.guru3d.com Guru3D]
  
GLU is also included in the system folder as glu32.dll
+
GLU is also included in the system folder as <code>glu32.dll</code>
This is also a system component. Updated dll should be placed in your program's folder. You can get a GLU's source code from [http://www.mesa3d.org MESA3D]
+
This is also a system component. Updated DLL should be placed in your program's folder. You can get a GLU's source code from [http://www.mesa3d.org MESA3D]. You can get precompiled lib from [http://www.geocities.com/vmelkon/glu.html vmelkon's GLU]; The current version is 1.3.
You can get precompiled lib from [http://www.geocities.com/vmelkon/glu.html vmelkon's GLU]
 
The current version is 1.3
 
  
Other libraries like GLUT, freeGLUT, QT, etc are not part of the OS. These should be downloaded from the net.
+
Other libraries like GLUT, freeGLUT, QT, etc are not part of the OS. These should be downloaded from the net. [http://www.opengl.org/resources/libraries/ GLUT and OpenGL Utility Libraries]
[http://www.opengl.org/resources/libraries/ GLUT and OpenGL Utility Libraries]
 
  
Windows 95, 98, Me, 2000 support GL 1.1 as a software rasterizer implemented in opengl32.dll<br>
+
Windows 95, 98, Me, 2000 support OpenGL version 1.1 as a software rasterizer implemented in <code>opengl32.dll</code>. There is no support for hardware acceleration therefore installing drivers is necessary. Windows XP supports OpenGL version 1.1 as a Direct3D wrapper in <code>opengl32.dll</code>. Since performance will be lousy, installing drivers is a good idea. On Windows 2003, you aren't suppose to use it as a desktop machine, but it is similar to Win 2000. Windows Vista will support OpenGL version 1.4 as a Direct3D wrapper. ''Always'' install drivers.
There is no support for hw acceleration therefore installing drivers is necessary.<br>
 
Windows XP supports GL 1.1 as a D3D wrapper in opengl32.dll<br>
 
Since performance will be lousy, installing drivers is a good idea.<br>
 
On Windows 2003, you aren't suppose to use it as a desktop machine, but it is similar to Win 2000<br>
 
Windows Vista will support GL 1.4 as a D3D wrapper. Always install drivers.<br>
 
<br>
 
<br>
 
How to make your first GL program?<br>
 
The first thing to do is chose a programming language. It could be C++, C++ Managed, Visual Basic, Visual Basic .NET, Pascal, Java, Ada, x86 assembly, etc.<br>
 
The second thing is to chose a compiler. It could be MS Visual C++, DevC++, Delphi, Masm, etc<br>
 
Remember that GL is a API so as long as you have the language bindings for your compiler, you can do GL programming.<br>
 
Typically, a compiler comes with the binding files. For example, if you have a C++ compiler, it will come with gl.h and opengl32.lib. It may even come with glu.h and glu32.lib, glut.h and glut32.lib<br>
 
If you don't have your binding files, you will need to figure out where to download them from.<br>
 
MS releases their platform SDK which contains these files and most likely you don't need it because your compiler came with the files.<br>
 
You might want to use SDL, GLUT, freeGLUT, or some other wrapper that takes care of creating a GL window for you and destroying for you. It makes it easier for someone who just wants to learn GL.<br>
 
<br>
 
Assuming you know how to program in your language of choice, now all you need is to learn GL. There are many online tutorials. Just search for opengl+tutorial with your browser.<br>
 
  
* [http://nehe.gamedev.net NEHE, many tutorials, basic]
+
=== 64 bits Windows versions ===
* [http://www.xmission.com/~nate/opengl.html GLUT, tutorials]
+
If you are running the 64 bit version of Windows Vista or perhaps you are running Windows XP x64, you might be wondering if there is a <code>OpenGL64.dll</code> file. The answer is no, there isn't. On both of these Operating Systems, <code>Windows\System32</code> contains all the 64 bit DLLs. It contains the <code>OpenGL32.dll</code> which is actually a 64 bit dll.
* [http://www.3dcafe.com/ 3D models]
+
 
* [http://www.sulaco.co.za/ Demoes]
+
For 32 bit programs, Windows detects the exe as a 32 bit program and instead of using System32 files, it uses Windows\SysWOW64 which actually contains the 32 bit DLLs. WOW means '''W'''indows '''O'''n '''W'''indows which is a backwards-compatibility layer.
* [http://www.geocities.com/SiliconValley/Bay/6525 3DS loader, keyframes]
+
 
* [http://www.humus.ca/ lots of demoes, advanced]
+
To find your Windows' System32 directory, go to: Start, Run... and type in <code>%WINDIR%\System32</code>. The system will redirect you to the default System32 directory automatically; this is also true for the 32 bits versions of Windows.
* [http://www.magic-software.com algorithms, intersection test]
 
* [http://local.wasp.uwa.edu.au/~pbourke/ many demoes and explanations, advanced]
 
* [http://freespace.virgin.net/hugo.elias/graphics/x_posure.htm exposure to light]
 
* [http://www.ogre3d.org 3D engine]
 
* [http://www.gameprog.com/opengl druid-'s GL Journal]
 
* [http://www.delphi3d.net Delphi programming and GL]
 
* [http://www.mesa3d.org A software renderer. Also the opengl32.dll for Linux systems]
 
* [http://www.flipcode.com many demoes]
 
  
==== Windows and 64 bit ====
+
== Linux ==
Assuming you are running the 64 bit version of Vista or perhaps you are running Win XP x64, you might be wondering if there is a OpenGL64.dll. No, there isn't. On both of these OSes, Windows\System32 contains all the 64 bit DLLs. It contains the OpenGL32.dll which is actually a 64 bit dll.<br>
 
For 32 bit programs, Windows detects the exe as a 32 bit program and instead of using System32 files, it uses Windows\SysWOW64 which actually contains the 32 bit DLLs. WOW means windows on windows. It is a compatibility layer.
 
It's unfortunate that Microsoft didn't just create a System64 folder and put in the 64 bit DLLs in there.<br>
 
Linux doesn't have this issue but it also stores 32 bit and 64 bit files in its folders.<br>
 
<br>
 
==== Linux ====
 
  
 
Graphics on Linux is almost exclusively implemented using the X windows system. Supporting OpenGL on Linux involves using GLX extensions to the X Server. There is a standard Application Binary Interface defined for OpenGL on Linux that gives application compatability for OpenGL for a range of drivers. In addition the Direct Rendering Infrastucture (DRI) is a driver framework that allows drivers to be written and interoperate within a standard framework to easily support hardware acceleration, the DRI is included in of XFree86 4.0 but may need a card specific driver to be configured after installation.
 
Graphics on Linux is almost exclusively implemented using the X windows system. Supporting OpenGL on Linux involves using GLX extensions to the X Server. There is a standard Application Binary Interface defined for OpenGL on Linux that gives application compatability for OpenGL for a range of drivers. In addition the Direct Rendering Infrastucture (DRI) is a driver framework that allows drivers to be written and interoperate within a standard framework to easily support hardware acceleration, the DRI is included in of XFree86 4.0 but may need a card specific driver to be configured after installation.
Line 86: Line 50:
 
For more information on developing OpenGL applications on Linux, see [[Platform specifics: Linux]]
 
For more information on developing OpenGL applications on Linux, see [[Platform specifics: Linux]]
  
Linux comes with Mesa libraries, which implements GL as a software rasterizer. Most Linux distros don't come with hw acceleration. Some distros may include hw acceleration. Also, some GPUs have Open Source drivers developed by the community even though a close source driver may be available from the manufacturer.
+
Linux comes with Mesa libraries, which implements the OpenGL API as a software rasterizer. Most Linux distros don't come with hardware acceleration. Some Linux distributions may include support for hardware acceleration. Also, some GPUs have Open Source drivers developed by the community even though a close source driver may be available from the manufacturer.
  
==== Mac OS X ====
+
== Mac OS X ==
Every version of Mac OS X has shipped with OpenGL runtime libraries pre-installed. Users who want to run OpenGL applications do not need to install or configure anything.
+
Every version of Mac OS X has shipped with OpenGL runtime libraries pre-installed. Users who want to run OpenGL applications do not need to install or configure anything.
  
Unlike other platforms, where the OS and OpenGL implementations are often updated separately, OpenGL updates are usually included as part of Mac OS X system updates. To obtain the latest OpenGL on Mac OS X, users should upgrade to the latest OS release [http://www.apple.com/macosx/upgrade/softwareupdates.html].
+
Unlike other platforms, where the Operating System and OpenGL implementations are often updated separately, OpenGL updates are usually included as part of Mac OS X system updates. To obtain the latest OpenGL on Mac OS X, users should upgrade to the latest OS release, which can be found at: [http://www.apple.com/macosx/upgrade/softwareupdates.html].
  
 
For developers, a default installation of Mac OS X does not include any OpenGL headers, nor does it include other necessary development tools.  These are installed by a separate developer tools package [http://developer.apple.com/tools/download/].  This installer includes the OpenGL headers, compilers (gcc), debuggers (gdb), Apple's Xcode IDE, and a number of performance tools useful for OpenGL application development.
 
For developers, a default installation of Mac OS X does not include any OpenGL headers, nor does it include other necessary development tools.  These are installed by a separate developer tools package [http://developer.apple.com/tools/download/].  This installer includes the OpenGL headers, compilers (gcc), debuggers (gdb), Apple's Xcode IDE, and a number of performance tools useful for OpenGL application development.
Line 97: Line 61:
 
For more information on developing OpenGL applications on Mac OS X, see [[Platform specifics: Mac OS X]].
 
For more information on developing OpenGL applications on Mac OS X, see [[Platform specifics: Mac OS X]].
  
=== OpenGL 2.0 and extensions ===
+
== OpenGL 2.0 and extensions ==
If you will be programming for Windows, typically compilers comes with a standard GL 1.1 .h and .lib<br>
+
If you will be programming for Windows, typically compilers comes with a standard OpenGL 1.1 <code>.h</code> and <code>.lib</code>.
For Linux and others, you might want to borrow the same idea (getting function pointers for the GL functions)<br>
+
For Linux and others, you might want to borrow the same idea (getting function pointers for the GL functions)
To access higher GL functions, you would have to get the function pointers.<br>
+
To access higher OpenGL functions, you would have to get the function pointers.
For example, in C or C++, this is what you would do<br>
+
For example, in C or C++, this is what you would do
<br>
+
 
Download glext.h and wglext.h from [http://www.opengl.org/registry/ The Extensions Registry]<br>
+
Download <code>glext.h</code> and <code>wglext.h</code> from [http://www.opengl.org/registry/ The Extensions Registry]
<br>
+
 
Put it in your compiler's GL folder<br>
+
Put it in your compiler's GL folder.
<br>
+
 
include <GL/gl.h><br>
+
<pre>
include <GL/glext.h><br>
+
include <GL/gl.h>
include <GL/wglext.h><br>
+
include <GL/glext.h>
<br>
+
include <GL/wglext.h>
extern PFNGLACTIVETEXTUREPROC glActiveTexture;  //Put this in a .h so that you can include the header in all your other .cpp<br>
+
 
PFNGLACTIVETEXTUREPROC glActiveTexture;    //Declare your function pointer in a .cpp file<br>
+
extern PFNGLACTIVETEXTUREPROC glActiveTexture;  //Put this in a .h so that you can include the header in all your other .cpp
<br>
+
PFNGLACTIVETEXTUREPROC glActiveTexture;    //Declare your function pointer in a .cpp file
Once you create a GL context, you can use wglGetProcAddress to get a pointer to the function.<br>
+
</pre>
<br>
+
 
glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");<br>
+
Once you create a GL context, you can use wglGetProcAddress to get a pointer to the function.
<br>
+
 
<br>
+
glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");
This would be tedious if you had to do this for all the functions and it's is even more work if you want to detect a certain GL version, then load all the core functions. Then, detect if a certain extension is present, then load all the functions.<br>
+
 
<br>
+
This would be tedious if you had to do this for all the functions and it's is even more work if you want to detect a certain OpenGL API version, then load all the core functions. Then, detect if a certain extension is present, then load all the functions.
There exists a few libraries out there that will get the function pointers for you. All you have to do is create a GL context and call the library's init function. The recent version of GLee doesn't require a call to its init function.<br>
+
 
 +
There exists a few libraries out there that will get the function pointers for you. All you have to do is create an OpenGL rendering context and call the library's init function. The recent version of GLee doesn't require a call to its init function.
 +
 
 
Examples are :
 
Examples are :
 
*[http://glew.sourceforge.net GLEW - The GL Extension Wrangler Library]
 
*[http://glew.sourceforge.net GLEW - The GL Extension Wrangler Library]
 
*[http://elf-stone.com/glee.php GLEE - GL Easy Extension library]
 
*[http://elf-stone.com/glee.php GLEE - GL Easy Extension library]
  
 +
== How to make your first OpenGL Program ==
 +
The first thing to do is chose a programming language. It could be C++, C++ Managed, Visual Basic, Visual Basic .NET, Pascal, Java, Ada, x86 assembly, etc.
 +
 +
The second thing is to chose a compiler. It could be MS Visual C++, DevC++, Delphi, Masm, etc. Remember that OpenGL is an API, so as long as you have the language bindings for your compiler, you can do OpenGL programming.
 +
 +
Typically, a compiler comes with the binding files. For example, if you have a C++ compiler, it will come with <code>gl.h</code> and <code>opengl32.lib</code>. It may even come with <code>glu.h</code> and <code>glu32.lib</code>, <code>glut.h</code> and <code>glut32.lib</code>.
 +
 +
If you don't have your binding files, you will need to figure out where to download them from. Microsoft releases their Windows Platform SDK which contains these files and most likely you don't need it because your compiler came with the files.
 +
 +
You might want to use SDL, GLUT, freeGLUT, or some other wrapper that takes care of creating a GL window for you and destroying for you. It makes it easier for someone who just wants to learn the OpenGL API syntax.
 +
 +
Assuming you know how to program in your language of choice, now all you need is to learn OpenGL. There are many online tutorials. Just search for <code>opengl+tutorial</code> in your favorite search engine.
 +
 +
* [http://nehe.gamedev.net NEHE, many tutorials, basic]
 +
* [http://www.xmission.com/~nate/opengl.html GLUT, tutorials]
 +
* [http://www.3dcafe.com/ 3D models]
 +
* [http://www.sulaco.co.za/ Demos]
 +
* [http://www.geocities.com/SiliconValley/Bay/6525 3DS loader, keyframes]
 +
* [http://www.humus.ca/ lots of demos, advanced]
 +
* [http://www.magic-software.com algorithms, intersection test]
 +
* [http://local.wasp.uwa.edu.au/~pbourke/ many demos and explanations, advanced]
 +
* [http://freespace.virgin.net/hugo.elias/graphics/x_posure.htm exposure to light]
 +
* [http://www.ogre3d.org 3D engine]
 +
* [http://www.gameprog.com/opengl druid-'s GL Journal]
 +
* [http://www.delphi3d.net Delphi programming and GL]
 +
* [http://www.mesa3d.org A software renderer. Also the opengl32.dll for Linux systems]
 +
* [http://www.flipcode.com many demos]
 +
 +
== OpenGL Viewers==
 +
These are programs that you install and run, and they give you information specific to the OpenGL API your system implements, like the version offered by your system, the vendor, the renderer, the extension list, supported viewport size, line size, point size, plus many other details. Some might include a benchmark. Some are standalone benchmarks.
  
=== OpenGL Viewers===
 
These are programs that you install and run, and they give you GL information like the version offered by your system, the vendor, the renderer, the extension list, supported viewport size, line size, point size, plus many other details. Some might include a benchmark. Some are standalone benchmarks.<br>
 
<br>
 
 
* [http://www.delphi3d.net/hardware/index.php Download GLInfo2 (Windows)]
 
* [http://www.delphi3d.net/hardware/index.php Download GLInfo2 (Windows)]
 
* [http://www.realtech-vr.com/glview/index.html OpenGL Extension Viewer (Windows, Windows x64 and MacOS X)]
 
* [http://www.realtech-vr.com/glview/index.html OpenGL Extension Viewer (Windows, Windows x64 and MacOS X)]
Line 135: Line 128:
 
* [http://www.devbump.com/story.php?title=Fur_Rendering_Benchmark_-_A_Small_and_Handy_OpenGL_Utility Fur rendering benchmark (Windows)]
 
* [http://www.devbump.com/story.php?title=Fur_Rendering_Benchmark_-_A_Small_and_Handy_OpenGL_Utility Fur rendering benchmark (Windows)]
 
* [http://www.futuremark.com/download/ Futuremark's GL ES benchmark]
 
* [http://www.futuremark.com/download/ Futuremark's GL ES benchmark]
 +
 +
[[Category:General OpenGL]]

Revision as of 20:39, 3 April 2008

So you want to take advantage of the power of the OpenGL API? If you are visiting this page because a game or software implements the OpenGL API, you need to install the appropriate graphic driver which enables usage of the functionality provided.

To program using the OpenGL API, you need the driver and the development package (depends on platform and programming language). More platform-specific details are described in the sections below.

Windows

If you are running Windows 98/Me/NT/2000/XP/2003, the OpenGL library has already been installed on your system. Win95A did not come with GL, so Microsoft has made this available at: Windows OpenGL library.

Remember that GL is a system component on Windows. DO NOT modify or copy opengl32.dll from one OS to another. The filename is opengl32.dll and is either in WINDOWS\SYSTEM, WINNT\SYSTEM32 or WINDOWS\SYSTEM32. This also means that you do not have to ship a copy of the library with your application since it will already be available on the system.

The standard Windows OpenGL32.dll library alone will not provide you with hardware acceleration for OpenGL. In order to get hardware acceleration, you will need to install the latest drivers for your graphics card:

Some sites also distribute beta versions of graphics drivers, which may give you access to bug fixes or new functionality before an official driver release from the manufacturer:

GLU is also included in the system folder as glu32.dll This is also a system component. Updated DLL should be placed in your program's folder. You can get a GLU's source code from MESA3D. You can get precompiled lib from vmelkon's GLU; The current version is 1.3.

Other libraries like GLUT, freeGLUT, QT, etc are not part of the OS. These should be downloaded from the net. GLUT and OpenGL Utility Libraries

Windows 95, 98, Me, 2000 support OpenGL version 1.1 as a software rasterizer implemented in opengl32.dll. There is no support for hardware acceleration therefore installing drivers is necessary. Windows XP supports OpenGL version 1.1 as a Direct3D wrapper in opengl32.dll. Since performance will be lousy, installing drivers is a good idea. On Windows 2003, you aren't suppose to use it as a desktop machine, but it is similar to Win 2000. Windows Vista will support OpenGL version 1.4 as a Direct3D wrapper. Always install drivers.

64 bits Windows versions

If you are running the 64 bit version of Windows Vista or perhaps you are running Windows XP x64, you might be wondering if there is a OpenGL64.dll file. The answer is no, there isn't. On both of these Operating Systems, Windows\System32 contains all the 64 bit DLLs. It contains the OpenGL32.dll which is actually a 64 bit dll.

For 32 bit programs, Windows detects the exe as a 32 bit program and instead of using System32 files, it uses Windows\SysWOW64 which actually contains the 32 bit DLLs. WOW means Windows On Windows which is a backwards-compatibility layer.

To find your Windows' System32 directory, go to: Start, Run... and type in %WINDIR%\System32. The system will redirect you to the default System32 directory automatically; this is also true for the 32 bits versions of Windows.

Linux

Graphics on Linux is almost exclusively implemented using the X windows system. Supporting OpenGL on Linux involves using GLX extensions to the X Server. There is a standard Application Binary Interface defined for OpenGL on Linux that gives application compatability for OpenGL for a range of drivers. In addition the Direct Rendering Infrastucture (DRI) is a driver framework that allows drivers to be written and interoperate within a standard framework to easily support hardware acceleration, the DRI is included in of XFree86 4.0 but may need a card specific driver to be configured after installation. These days, XFree86 has been rejected in favor of XOrg due to the change in the license of XFree86, so many developers left Xfree86 and joined the XOrg group. Popular Linux distros come with XOrg now. Developers

Vendors have different approaches to drivers on Linux, some support Open Source efforts using the DRI, and others support closed source frameworks but all methods support the standard ABI that will allow correctly written OpenGL applications to run on Linux.

For more information on developing OpenGL applications on Linux, see Platform specifics: Linux

Linux comes with Mesa libraries, which implements the OpenGL API as a software rasterizer. Most Linux distros don't come with hardware acceleration. Some Linux distributions may include support for hardware acceleration. Also, some GPUs have Open Source drivers developed by the community even though a close source driver may be available from the manufacturer.

Mac OS X

Every version of Mac OS X has shipped with OpenGL runtime libraries pre-installed. Users who want to run OpenGL applications do not need to install or configure anything.

Unlike other platforms, where the Operating System and OpenGL implementations are often updated separately, OpenGL updates are usually included as part of Mac OS X system updates. To obtain the latest OpenGL on Mac OS X, users should upgrade to the latest OS release, which can be found at: [1].

For developers, a default installation of Mac OS X does not include any OpenGL headers, nor does it include other necessary development tools. These are installed by a separate developer tools package [2]. This installer includes the OpenGL headers, compilers (gcc), debuggers (gdb), Apple's Xcode IDE, and a number of performance tools useful for OpenGL application development.

For more information on developing OpenGL applications on Mac OS X, see Platform specifics: Mac OS X.

OpenGL 2.0 and extensions

If you will be programming for Windows, typically compilers comes with a standard OpenGL 1.1 .h and .lib. For Linux and others, you might want to borrow the same idea (getting function pointers for the GL functions) To access higher OpenGL functions, you would have to get the function pointers. For example, in C or C++, this is what you would do

Download glext.h and wglext.h from The Extensions Registry

Put it in your compiler's GL folder.

include <GL/gl.h>
include <GL/glext.h>
include <GL/wglext.h>

extern PFNGLACTIVETEXTUREPROC glActiveTexture;  //Put this in a .h so that you can include the header in all your other .cpp
PFNGLACTIVETEXTUREPROC glActiveTexture;    //Declare your function pointer in a .cpp file

Once you create a GL context, you can use wglGetProcAddress to get a pointer to the function.

glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");

This would be tedious if you had to do this for all the functions and it's is even more work if you want to detect a certain OpenGL API version, then load all the core functions. Then, detect if a certain extension is present, then load all the functions.

There exists a few libraries out there that will get the function pointers for you. All you have to do is create an OpenGL rendering context and call the library's init function. The recent version of GLee doesn't require a call to its init function.

Examples are :

How to make your first OpenGL Program

The first thing to do is chose a programming language. It could be C++, C++ Managed, Visual Basic, Visual Basic .NET, Pascal, Java, Ada, x86 assembly, etc.

The second thing is to chose a compiler. It could be MS Visual C++, DevC++, Delphi, Masm, etc. Remember that OpenGL is an API, so as long as you have the language bindings for your compiler, you can do OpenGL programming.

Typically, a compiler comes with the binding files. For example, if you have a C++ compiler, it will come with gl.h and opengl32.lib. It may even come with glu.h and glu32.lib, glut.h and glut32.lib.

If you don't have your binding files, you will need to figure out where to download them from. Microsoft releases their Windows Platform SDK which contains these files and most likely you don't need it because your compiler came with the files.

You might want to use SDL, GLUT, freeGLUT, or some other wrapper that takes care of creating a GL window for you and destroying for you. It makes it easier for someone who just wants to learn the OpenGL API syntax.

Assuming you know how to program in your language of choice, now all you need is to learn OpenGL. There are many online tutorials. Just search for opengl+tutorial in your favorite search engine.

OpenGL Viewers

These are programs that you install and run, and they give you information specific to the OpenGL API your system implements, like the version offered by your system, the vendor, the renderer, the extension list, supported viewport size, line size, point size, plus many other details. Some might include a benchmark. Some are standalone benchmarks.