OpenGL
OpenGL (da Open Graphics Library, ossia libreria aperta di grafica) è una specifica che definisce una API per più linguaggi e per più piattaforme per scrivere applicazioni che producono computer grafica 3D e 2D. L'interfaccia consiste in circa 250 diverse chiamate di funzione che si possono usare per disegnare complesse sxcene tridimensionali da semplici primitive. È molto usato nell'industria dei videogiochi (nella quale compete con Direct3D su Microsoft Windows). OpenGL viene usato anche per applicazioni di CAD, realtà virtuale, CAE.
Esistono implementazioni efficienti di OpenGL (che sfruttano in modo più o meno completo le GPU) per Microsoft Windows, molte piattaforme Unix, la Playstation 3, e il Mac OS. Queste implementazioni vengono normalmente fornite dai costruttori di dispositivi video e si affidano pesantemente sull'hardware fornito dal costruttore. La libreria open source Mesa è un'API grafica basata solamente su librerie software che è compatibile con OpenGL. Tuttavia, a causa della licenza, può solo sostenere di di essere un'API "molto simile".
La specifica di OpenGL è supervisionata dall'OpenGL Architecture Review Board (ARB), che si è formato nel 1992. L'ARB consiste in un insieme di aziende interessate a creare un'API coerente e ampiamente disponibile. Secondo il sito Web ufficiale di OpenGL, i membri votanti dell'ARB nel novembre del 2004 erano: 3Dlabs, Apple Computer, ATI Technologies, Dell, Evans & Sutherland, Hewlett-Packard, IBM, Intel, Matrox, NVIDIA, SGI e Sun Microsystems. (Microsoft, uno dei membri fondatori, se n'è andato nel marzo del 2003.)
Estensioni
Lo standard OpenGL permette ai produttori individuali di fornire funzionalità aggiuntive tramite le estensioni man mano che vengono create nuove tecnologie. Un'estensione viene poi distribuita in due parti: come file di intestazione che contiene i prototipi di funzione dell'estensione, e come driver del produttore.
Ogni produttore ha un'abbreviazione alfabetica che viene usata nel denominare le loro nuove funzioni e costanti.
Per esempio, l'abbreviazione di NVIDIA (NV) viene usata nel definire la loro funzione propriataria glCombinerParameterfvNV()
e la loro costante GL_NORMAL_MAP_NV
.
Può succedere che più di un produttore si accordi per implementare la stessa funzionalità estesa.
In that case, the abbreviation EXT is used. It may further happen that the Architecture Review Board "blesses" the extension. It then becomes known as a standard extension, and the abbreviation ARB is used. The first ARB extension was GL_ARB_multitexture
. Following the official extension promotion path, multitexturing is no longer an optionally implemented ARB extension, but has been a part of the OpenGL core API since version 1.4.
Specifications for nearly all extensions can be found at the official extension repository [1].
Several libraries are built on top of OpenGL to provide features not available in OpenGL itself:
In particular, the OpenGL Performer library, developed by SGI and available for IRIX, Linux, and several versions of Microsoft Windows, builds on OpenGL to enable the creation of real-time visual simulation applications.
Bindings
In order to enforce its multi-language and multi-platform characteristics, various bindings and ports have been developed for OpenGL in many languages. Most notably, the Java 3D library can rely on OpenGL for its hardware acceleration. Very recently, Sun has released beta versions of the JOGL system, which provides direct bindings to C OpenGL commands, unlike Java 3D which does not provide such low level support. The OpenGL official page [2] lists various bindings for Java, Fortran 90, Perl, Pike, Python, Ada, and Visual Basic. Bindings are also available for C++ and C#, see [3].
Higher level functionality
OpenGL was designed to be output-only: it provides only rendering functions. The core API has no concept of windowing systems, audio, printing, keyboard/mouse, or other input devices. While this seems restrictive at first, it allows the code that does the rendering to be completely independent of the operating system it is running on, allowing cross-platform development. However some integration with the native windowing system is required to allow clean interaction with the host system. This is performed through the following add-on APIs:
Additionally the GLUT and SDL libraries provide functionality for basic windowing using OpenGL, in a portable manner. Mac OS X has three APIs to get OpenGL support: AGL for Carbon, NSOpenGL for Cocoa and CGL for direct access.
History
OpenGL evolved from (and is very similar in style to) SGI's earlier 3D interface, IRIS GL. One of the restrictions of IRIS GL was that it only provided access to features supported by the underlying hardware. If the graphics hardware did not support a feature, then the application could not use it. OpenGL overcame this problem by providing support in software for features unsupported by hardware, allowing applications to use advanced graphics on relatively low-powered systems. The Fahrenheit project was a joint effort between Microsoft, SGI, and Hewlett-Packard with the goal of unifying the OpenGL and Direct3D interfaces. It initially showed some promise of bringing order to the world of interactive 3D computer graphics APIs, but due to financial constraints at SGI and general lack of industry support, it has since been abandoned.
Future in Microsoft Windows
On 6th August [2005], Microsoft's intentions for OpenGL support in Windows Vista were revealed on in an Opengl.org news announcement:
Microsoft's current plan for OpenGL on Windows Vista is to layer OpenGL over Direct3D in order to use OpenGL with a composited desktop to obtain the Aeroglass experience. If an OpenGL ICD is run - the desktop compositor will switch off - significantly degrading the user experience.
In practice this means for OpenGL under Aeroglass:
OpenGL performance will be significantly reduced - perhaps as much as 50%
OpenGL on Windows will be fixed at a vanilla version of OpenGL 1.4
No extensions will be possible to expose future hardware innovations
It would be technically straightforward to provide an OpenGL ICD within the full Aeroglass experience without compromising the stability or the security of the operating system. Layering OpenGL over Direct3D is a policy more than a technical decision.
As a result, the future of OpenGL as a mainstream library for computer and video games now looks precarious. Microsoft have taken the decision not to release the information necessary to allow third parties (such as those at NVidia, ATI or the other large graphics card manufacturers) to develop replacement drivers, leaving no way to avoid the 50% speed drop. A 3Dlabs employee states in the same Opengl.org thread:
This information came from the OpenGL BOF held at Siggraph 2005 in LA this last Wednesday evening. This was confirmed at the BOF by NVIDIA, ATI and us (3Dlabs).
As soon as an [installable client driver] is loaded the composited desktop is turned off on Windows Vista. If you want the composited desktop Aeroglass experience, you will need to make your application go through Microsoft's OpenGL implementation, which is layered on top of DirectX. As pointed out earlier, this layering can have performance implications. Their implementation supports OpenGL version 1.4 only, without extension support.
We believe it possible to provide an ICD with full composited desktop support while adhering to the stability and security requirements in Windows Vista. But we need Microsoft's help in doing so.
Therefore, as mentioned before, please let your contact in the ISV or IHV or OEM community know how you feel about this and spread the word.
For some more information, you can browse these Microsoft Winhec slides:
"Windows Graphics Overview [WinHEC 2005; 171 KB]" http://download.microsoft.com/download/9/8/f/98f3fe47-dfc3-4e74-92a3-088782200fe7/TWPR05007_WinHEC05.ppt
"Advances in Display and Composition Architecture for Windows [WinHEC 2005; 422 KB]" http://download.microsoft.com/download/9/8/f/98f3fe47-dfc3-4e74-92a3-088782200fe7/TWPR05005_WinHEC05.ppt
Regards,
Barthold
3Dlabs
An installable client driver is the glue provided by a card manufacturer to connect Windows and your graphics card.
OpenGL 2.0
OpenGL 2.0 was conceived of by 3Dlabs to address concerns that OpenGL was stagnating and lacked a strong direction. 3Dlabs proposed a number of major additions to the standard, the most significant of which was GLSL (the OpenGL Shading Language). This would enable the programmer to replace the OpenGL fixed-function vertex and fragment pipelines with shaders written in a C-like language. GLSL was notable for making relatively few concessions to the limitations of the hardware then available; this harked back to the earlier tradition of OpenGL setting ambitious, forward-looking targets for new 3D accelerators rather than merely tracking the state of currently available hardware. The final OpenGL 2.0 spec [4] included support for GLSL, but omitted many of the other features originally proposed - these were deferred to future versions of OpenGL, although some are now available as extensions.
Further reading
- Fosner, Ron: OpenGL Programming for Windows 95 and Windows NT, Addison Wesley, ISBN 0-201-40709-4
- OpenGL Architecture Review Board, et al: OpenGL Reference Manual: The Official Reference Document to OpenGL, Version 1.4, Addison Wesley, ISBN 0-321-17383-X
- Rost, Randi J.: OpenGL Shading Language, Addison Wesley, ISBN 0-321-19789-5
- OpenGL Architecture Review Board, et al: OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 1.4, Fourth Edition, Addison Wesley, ISBN 0-321-17348-1
External links
- 2D to 3D surface conversion and texture manipulation routines by Walter Muncaster (User:0waldo)
- Official website
- Tutorials and learning material from Neon Helium Productions
- Online copy of an early edition of The OpenGL Programming Guide
Programmer resources
- CodeSampler.com - Code samples and tutorials for OpenGL game programming.
- OpenGL Directory - Compilation of resources and links for anything OpenGL.
- OpenGL Lighting Model
- Basic OpenGL Lighting - an explanation of the standard OpenGL lighting by Steve Baker