Difference between revisions of "OpenGL"

From Lazarus wiki
Jump to navigationJump to search
m
(glext contains higher lib)
Line 1: Line 1:
{{OpenGL}}
+
OpenGL ('''Open''' '''G'''raphics '''L'''ibrary) is a cross-platform API for producing 3D computer graphics. Most modern video cards provide hardware accelerated OpenGL support, wich makes OpenGL a good solution for writing advanced graphics software.
  
OpenGL is the platform independent standard library for 3D graphics. The same OpenGL commands works exactly the same under all platforms.
 
The only platform dependent part is the creation of the OpenGL context. But this is already done by the following packages, so you just have to learn OpenGL.
 
  
== OpenGL control ==
+
The FreePascal OpenGL interface consists of the following units:
 
+
* '''gl''': This unit contains the main functionality such as drawing polygons, applying transformations, setting colors and materials,... Procedures always start with the preposition "gl".
Lazarus comes with a simple and easy to use OpenGL control, that provides an OpenGL context under the following platforms:
+
* '''glu''': This unit contains OpenGL utils. Although it has some usefull functions, this unit is not necessary as you can implement all glu Procedures with the functionality of the gl unit. Procedures always start with the preposition "glu".
 
+
* '''glext''': Vendors can provide additional functionality through extensions. Use this unit to use these extensions. <p>The functionality specific to higher OpenGL versions (1.2 and later) is available in this unit as well. Initializing this functionality is similar to initializing normal OpenGL extensions: just call Load_GL_version_X_Y function. If your OpenGL library version is older than X.Y, Load_GL_version_X_Y will return false.</p>
* Linux: GTK + GLX, ToDo: gtk2
+
* '''glut''': This unit provides functionality for creating an OpenGL window. Although this is a cross-platform unit, most Windows operating systems don't have a glut dll by default.
* FreeBSD: GTK + GLX, ToDo: gtk2
+
* '''glx''': glx provides functionality to set up an OpenGL window in an x window system. Procedures always start with the preposition "glx". Obviously, you cannot use this unit on non-x window systems such as Windows.
* Windows: Win32 + WGL
 
* MacOSX: Carbon + AGL
 
 
 
Just install the package components/opengl/lazopenglcontext.lpk and have a look at the example.
 
 
 
== GLScene ==
 
 
 
There is a big Delphi package, that has been ported to Lazarus. Along with tools and editors integrated in the IDE.
 
See [[GLScene]].
 
 
 
== Asmoday ==
 
 
 
[http://sourceforge.net/projects/asmoday General purpose OpenGL 3D graphics engine for Freepascal]
 
 
 
== Tutorials ==
 
 
 
There are a lot of tutorials at [http://nehe.gamedev.net/ nehe].
 
 
 
[[OpenGL Tutorial|OpenGL Tutorial]]
 

Revision as of 20:29, 11 October 2006

OpenGL (Open Graphics Library) is a cross-platform API for producing 3D computer graphics. Most modern video cards provide hardware accelerated OpenGL support, wich makes OpenGL a good solution for writing advanced graphics software.


The FreePascal OpenGL interface consists of the following units:

  • gl: This unit contains the main functionality such as drawing polygons, applying transformations, setting colors and materials,... Procedures always start with the preposition "gl".
  • glu: This unit contains OpenGL utils. Although it has some usefull functions, this unit is not necessary as you can implement all glu Procedures with the functionality of the gl unit. Procedures always start with the preposition "glu".
  • glext: Vendors can provide additional functionality through extensions. Use this unit to use these extensions.

    The functionality specific to higher OpenGL versions (1.2 and later) is available in this unit as well. Initializing this functionality is similar to initializing normal OpenGL extensions: just call Load_GL_version_X_Y function. If your OpenGL library version is older than X.Y, Load_GL_version_X_Y will return false.

  • glut: This unit provides functionality for creating an OpenGL window. Although this is a cross-platform unit, most Windows operating systems don't have a glut dll by default.
  • glx: glx provides functionality to set up an OpenGL window in an x window system. Procedures always start with the preposition "glx". Obviously, you cannot use this unit on non-x window systems such as Windows.