OpenGL

from Wikipedia, the free encyclopedia
OpenGL

OpenGL logo
Basic data

developer Khronos Group
Publishing year 1992
Current  version 4.6
(July 30, 2017)
operating system cross-platform
programming language C.
category API
License different
www.opengl.org

OpenGL ( Open G raphics L ibrary ; German Open Graphics Library ) is a specification of a platform and programming multi- programming interface (API) for developing 2D and 3D computer graphics applications . The OpenGL standard describes around 250 commands that allow the display of complex 3D scenes in real time . In addition, other organizations (mostly manufacturers of graphics cards ) can define proprietary extensions.

The OpenGL API is usually implemented using system libraries , and on some operating systems as part of the graphics card driver . These execute commands from the graphics card accordingly; in particular, functions that do not exist on the graphics card must be emulated by the CPU .

The successor to OpenGL is Vulkan .

The programming model

Diagram of the OpenGL graphics pipeline

Many parameters can affect the appearance of rendered objects, for example they can be textured and lit, stretched, shifted, transparent or opaque, they can have a rough or smooth surface, and so on.

OpenGL was designed as a state machine that does not receive all required parameters with every function call, but uses the same values ​​until the corresponding states are changed. In this way you don't need to tell OpenGL the desired color for each vertex , for example , but set a color once, whereupon all subsequent vertices are displayed in this color. In the same way, light sources can be switched on or off globally and many other states can be set.

The reason for this design is that almost every change in the drawing mode entails extensive reorganization of the graphics pipeline , so it is better to avoid this as long as it makes sense. It would also be tiresome for the programmer to enter dozens of parameters over and over again. Often many thousands of vertices can be edited before a state has to be changed again, while some states are even never changed. For example, the light sources mostly remain the same for all objects in a scene. Many states are retained at least for the duration of the rendering of a complete object, for example a car as a whole is moved around a certain vector and not broken down into its individual parts and then moved individually. This state-based concept is also followed in Direct3D .

Extensions

An important property of OpenGL is its extensibility. Individual providers (typically graphics card manufacturers) can expand the OpenGL state machine to include additional states. A four-stage procedure is followed:

  1. If a manufacturer wants to implement an extension, he delivers a C header file in which he defines the extension with the necessary constants and possibly function prototypes. The function names and constants are given a manufacturer-specific suffix (e.g. NV for Nvidia or ATI for ATI ).
  2. If several manufacturers then agree to offer the same extension, the function names and constants are given the suffix EXT.
  3. If the ARB (Architecture Review Board) finally agrees to standardize the extension, all names will be given the suffix ARB.
  4. Most of the extensions standardized by the ARB are then "core" in the following OpenGL specification, that is, they become part of OpenGL itself and then no longer have a suffix.

Historical development

OpenGL was originally developed from IRIS GL developed by Silicon Graphics (SGI) . The OpenGL 1.0 version was written by Mark Segal and Kurt Akeley. In the so-called Fahrenheit project , Microsoft and SGI tried to unify their 3D standards, but the project was canceled due to financial difficulties on the part of SGI.

The OpenGL standard is set by the OpenGL ARB (Architecture Review Board). The ARB has existed since 1992 and consists of a number of companies. Voting members are the companies 3DLabs , Apple , AMD / ATI , Dell , IBM , Intel , Nvidia , SGI and Sun (as of Nov. 2004). Other companies involved are Evans & Sutherland , Imagination Technologies , Matrox , Quantum3D , S3 Graphics , Spinor GmbH , Tungsten Graphics and Xi Graphics . Microsoft , one of the founding members, left the ARB in March 2003.

New functions in OpenGL are usually first introduced as manufacturer-specific extensions and then go through manufacturer-independent extensions and ARB extensions to core functionality. This makes it possible to use the latest possibilities of graphics hardware and still keep OpenGL abstract enough.

Since July 31, 2006, the further development of the OpenGL API has been in the hands of the Khronos Group .

history

Legend: Older version; no longer supported Older version; still supported Current version Current preliminary version Future version
version publication Description / changes
Older version; no longer supported: 1.0 January 1992 first publication
Older version; still supported: 1.1 January 1997
  • Vertex arrays
  • Texture Objects
  • Polygon offset
Older version; still supported: 1.2 March 16, 1998
Older version; still supported: 1.2.1 October 14, 1998
  • ARB extensions introduced
  • ARB multitexture
Older version; still supported: 1.3 August 14, 2001
  • compressed textures
  • Cube maps
  • Multitexturing
Older version; still supported: 1.4 July 24, 2002
  • Depth textures (for shadow mapping)
  • automatic mip-map generation
  • Fog coordinates
Older version; still supported: 1.5 July 29, 2003
  • Buffer objects (holding data in the graphics memory)
  • Occlusion queries
Older version; still supported: 2.0 September 7, 2004
  • Shader programs: OpenGL Shading Language
  • Multiple render targets
  • Textures of any size (no more 2 n for height and width)
Older version; still supported: 2.1 August 2, 2006
  • Pixel Buffer Objects
  • OpenGL Shading Language 1.20
  • sRGB textures
Older version; still supported: 3.0 "Longs Peak" August 11, 2008 [originally planned goals, only partially implemented]
  • Code base cleaned up
  • OpenGL Shading Language 1.30
  • Removal of legacy issues ( glBegin / glEnd , Fixed-Function-Pipeline, T&L etc.)
  • the architecture as a whole (layer model) approaches DirectX
  • For the first time, as far as possible waiver of explicit downward compatibility
Older version; still supported: 3.1 "Longs Peak Reloaded" March 24, 2009
  • Further removal of legacy issues (e.g. fixed function options, direct mode and color index mode), these are only available via the optional "compatibility extension"
  • OpenGL Shading Language 1.40
  • Uniform buffer objects
  • Vertex shader programs allow at least 16 texture lookups
  • Primitive restart
  • Instancing
  • CopyBuffer API in cooperation with OpenCL .
Older version; still supported: 3.2 August 3, 2009
  • higher execution speed
  • improved display quality
  • accelerated geometry processing
  • simplified porting of Direct3D applications
  • OpenGL Shading Language 1.50
  • Geometry shaders are now also supported directly in the OpenGL kernel when programming graphics pipelines
  • five ARB extensions
Older version; still supported: 3.3 March 11, 2010
  • Integration of OpenCL
  • OpenGL Shading Language 3.30
Older version; still supported: 4.0 March 11, 2010
  • Integration of OpenCL
  • Tessellation
  • OpenGL Shading Language 4.00
Older version; still supported: 4.1 July 26, 2010
  • Load binary shader programs to save time
  • 64-bit floating point components with vertex shader input for higher precision
  • Multiple viewports for one render surface
  • OpenGL Shading Language 4.10
Older version; still supported: 4.2 August 8, 2011
  • OpenGL Shading Language 4.20
Older version; still supported: 4.3 August 6, 2012
  • Compute shader programs for universal calculations
  • OpenGL Shading Language 4.30
  • Cross-platform texture compression according to ETC2 / EAC
  • More stability between the OpenGL applications
Older version; still supported: 4.4 22. July 2013
  • More control over the placement of the "buffer" in memory
  • OpenGL Shading Language 4.40
  • Bind several OpenGL objects to the context at the same time
  • Compute shader with variable work group size
Older version; still supported: 4.5 11th August 2014
  • Direct State Access (DSA)
  • Flush control
  • robustness
  • OpenGL ES 3.1 API and shader compatibility
  • DX11 emulation features
Current version: 4.6 July 30, 2017
  • Support from SPIR-V

The big leap from OpenGL 1.5 to 2.0 can be explained with the introduction of the "OpenGL Shading Language". This is such a big change and expansion that the ARB decided to take this step. The Khronos Group announced the specification for OpenGL 3.0 on August 11th at Siggraph 2008. The API has been extensively revised (away from the fixed function pipeline - towards the shaders or programs, away from the state machine - towards an object-based system). OpenGL is still backwards compatible, but there are no longer any new functions for the old API. For the first time, the new OpenGL has the powerful geometry shaders of the 3.0 model.

With the rapid release of OpenGL 4.0 and its feature set - especially the introduction of tessellation - the Khronos Group has been able to catch up again for a long time and has again entered into competition with DirectX (11).

NVIDIA has introduced several new ARBs under the titles OpenGL 2015 and OpenGL 2016. Some of this became standard with OpenGL 4.6. In 2017 and 2018, further extensions, especially for VR and ray tracing, were made available for Pascal and Turing.

Longs Peak and the OpenGL 3.0 Controversy

Before the release of the OpenGL 3.0 version on August 11, 2008, this revision of the API was known under the code name "Longs Peak". At the time of the original announcement, Longs Peak was presented as the very first major and in-depth overhaul of the API interface in OpenGL history. This consisted of a fundamental revision of the way OpenGL works, which should result in fundamental changes to the API. In order to ensure downward compatibility with older software despite the extensive changes and revolutionary innovations that have been announced, older versions of the API should still be available, but no new functions should be incorporated there. This would have allowed old program code, such as B. in the majority of CAD applications - which have been using their code base almost unchanged for decades - continue to run with older versions of the OpenGL API, while other programs would gradually have been rewritten or ported to the new interface.

Longs Peak was originally supposed to be released in September 2007 under the name OpenGL 3.0. Then, however, on October 30, 2007, the Khronos Group announced that it had encountered various issues that it wanted resolved before releasing the specifications.

As a result, publication postponed and the sources of information ceased completely. The Khronos group was used to coordinate the further development, as innovations and ideas were difficult and very time-consuming to implement due to the numerous members. After starting her job, she strived for a clear and tight schedule with clearly defined goals and committed herself to more open communication.

The specifications ultimately adopted turned out to be far less spectacular than advertised. Large parts of the code were retained and the object mode presented was not integrated. There are also no known plans to submit these in future versions. In the end, the API has remained largely the same, with a few additions to the core functionality.

This disappointing result caused dissatisfaction among some developer groups, as they had hoped for groundbreaking innovations and a serious, future-oriented, cross-platform competitor product to Microsoft's DirectX. In protest, some threatened to switch to DirectX in the future. Most of the disappointment was blamed on the lack of communication on the part of Khronos. One felt downright locked out and left in the dark. Other criticisms were made of the need for DirectX 10 capable hardware and the lack of geometry shaders and instanced rendering as core functions.

Other sources indicate that the response from the developer community has not been as bad as originally reported, with many vendors showing planned support for the new version.

Advantages and disadvantages of OpenGL compared to Direct3D

advantages
  • Client-server model
  • Draw calls are more powerful than Direct3D under certain circumstances
  • cross-platform
  • expandable by manufacturers themselves
  • There are a number of extensions for new functions not yet supported by the standard
  • the available features depend on the GPU or its driver, not on the operating system
disadvantage
  • OpenGL still has a partially outdated and more complex to use programming interface (API), which some developers consider cumbersome.

Interfaces to the system

Since OpenGL is a pure graphics library, it does not care about the management of drawing surfaces (windows), other buffers (such as the Z-Buffer or the Stencil-Buffer ) or rendering contexts to use the interface with several applications at the same time to be able to. These must be made available with the help of the intended, operating system-dependent libraries.

There are several libraries that connect OpenGL to the underlying operating system:

  • AGL and CGL, the corresponding counterpart for macOS ,
  • FreeGLUT , a newer alternative to the no longer developed GLUT,
  • GLFW , a library similar to GLUT, which abstracts the underlying operating system,
  • GLUT , a library that, based on OpenGL, GLU and, depending on the platform, GLX, WGL or AGL, offers a cross-platform API for input / output, creating rendering contexts and the like,
  • GLX , which forms the interface between the X Window System and OpenGL,
  • With GtkGLExt, OpenGL graphics can be integrated into GTK + programs (cross-platform),
  • LWJGL , interface for programming with Java,
  • Qt , can create OpenGL contexts and offers many options for interaction with its own library
  • SDL , can also create an OpenGL context across platforms,
  • SFML , also uses an OpenGL rendering context across platforms for drawing in windows,
  • WebKit uses OpenGL for hardware acceleration,
  • WGL, the Windows Graphics Library that connects OpenGL and Windows .

Command syntax

OpenGL command syntax

OpenGL commands contain a prefix that indicates which library the command comes from, followed by words that begin with capital letters:

gl * glu * embers *
Basic command of the OpenGL Library OpenGL Utility Library (GLU) command OpenGL Utility Toolkit (GLUT) command
z. B.glShadeModelO z. B.gluNurbsSurfaceO z. B.glutCreateWindowO

Typical uses for OpenGL

Due to the continuity of the platform, programs run up to 40 times faster than 12 years ago compared to AMD graphics cards and with up to 15 times less consumption per action, without having to change the program code.

Supported Platforms

OpenGL is supported by many operating systems, including most of the leading ones:

Open Graphics Library for Embedded Systems (OpenGL ES) is available for the following platforms:

Cross-platform (Windows, Mac OS, Solaris and Linux) OpenGL is also supported by the additions JOGL or LWJGL of the Java platform , which act as a wrapper between Java and the native implementation of the operating system.

WebGL

WebGL is a component of web browsers based on OpenGL ES , with the help of which hardware-accelerated 3D graphics can be displayed directly.

volcano

On March 3, 2015, the successor to OpenGL was presented at the Game Developers Conference (GDC). The new API, initially known as Next Generation OpenGL or glNext , is called Vulkan.

See also

  • DevIL , a cross-platform API for quickly loading and saving graphics. Formerly OpenIL . Works very well with OpenGL, as it is possible to load an image file into an OpenGL texture or to save screen shots with a single function call.
  • Direct rendering infrastructure
  • OpenGL Utility Library (GLU) standardized by the ARB and part of every OpenGL implementation.
  • Java 3D , a library of Java classes for creating, manipulating and displaying three-dimensional graphics within Java applications and applets. Uses OpenGL or Direct3D depending on the platform and implementation.
  • AMD Mantle , a programming interface for graphics output developed by AMD.
  • Open Inventor , a free, object-oriented C ++ program library for creating 3D graphics.
  • OpenAL , a cross-platform 3D audio API that is a kind of audio extension to OpenGL and is based on OpenGL in terms of structure, programming style and naming conventions.
  • Simple DirectMedia Layer (SDL), a cross-platform API for graphics, audio and input devices including OpenGL-specific functionality.

literature

  • Graham Sellers, Richard S. Wright, and Nicholas Haemel: OpenGL Superbible: Comprehensive Tutorial and Reference . Addison-Wesley Longman, Amsterdam 2015, ISBN 978-0-672-33747-5 .
  • Lorenz Burggraf: Now I'm learning OpenGL. The simple introduction to interface programming . Markt + Technik, Munich 2003, ISBN 3-8272-6237-2 .
  • Dave Shreiner, Graham Sellers, John Kessenich and Bill Licea-Kane: OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3 . Addison-Wesley Longman, Amsterdam 2013, ISBN 978-0-321-77303-6 .

Web links

Individual evidence

  1. sgi.com
  2. History of OpenGL - OpenGL Wiki. Retrieved March 2, 2017 (English).
  3. OpenGL 3.1 specifications (PDF; 2.2 MB)
  4. opengl.org (PDF) OpenGL Core Specification with changes marked
  5. a b c d e f g h opengl.org
  6. opengl.org
  7. OpenGL 3.3 and 4.0 - bye DirectX 11? - Article at Golem.de , from March 11, 2010.
  8. on-demand.gputechconf.com (PDF)
  9. khronos.org (PDF)
  10. khronos.org (PDF)
  11. phoronix.com
  12. developer.nvidia.com
  13. opengl.org
  14. on-demand.gputechconf.com
  15. de.slideshare.net
  16. developer.nvidia.com
  17. nvidia.com Source: Nvidia
  18. Bringing Unreal Engine 4 to OpenGL (PDF) Nvidia Developer. Retrieved August 24, 2014.
  19. ^ Things that drive me nuts about OpenGL . Rich Geldreich's Tech Blog. Retrieved August 24, 2014.
  20. ^ OpenGL Is Broken . Retrieved August 24, 2014.
  21. GTK + OpenGL Extension
  22. ^ Alfred Nischwitz, Max Fischer, Peter Haberacker: Computer graphics and image processing . 2nd Edition. Vieweg-Verlag , 2007, ISBN 978-3-8348-0186-9 , p. 48 .
  23. core.ac.uk (PDF)
  24. phoronix.com