Core OpenGL: Difference between revisions

Content deleted Content added
mNo edit summary
 
(48 intermediate revisions by 30 users not shown)
Line 1:
{{Use mdy dates|date=October 2013}}
'''Core OpenGL''', or '''CGL''', is [[Apple Computer]]'s Macintosh Quartz windowing system interface to the [[Mac OS X]] implementation of the [[OpenGL]] specification. CGL is analogous to [[GLX]], which is the [[X11]] interface to OpenGL as well as WGL, which is the [[Microsoft Windows]] interface to OpenGL.
{{Mac OS X graphics model}}
 
'''Core OpenGL''', or '''CGL''', is [[Apple ComputerInc.]]'s Macintosh Quartz [[windowing system]] interface to the [[Mac OS X]] implementation of the [[OpenGL]] specification. CGL is analogous to [[GLX]], which is the [[X11]] interface to OpenGL, as well as [[WGL (API)|WGL]], which is the [[Microsoft Windows]] interface to OpenGL.
On OS X, CGL is the foundation layer of windowing system interfaces to OpenGL. Both AGL (Apple OpenGL) and the [[Cocoa (API)]] (or AppKit) have interfaces to OpenGL and are logical software layers and depend on CGL for their behavior. CGL and AGL interoperate freely. CGL and Cocoa may be used together, however Cocoa classes may implicitly make changes to CGL state. Function calls from AGL and Cocoa should not be mixed.
 
==History==
All windowing system interfaces to [[OpenGL]] arose out of the migration of [[Silicon Graphics]] proprietary 3D graphics application programming interface ([[API]]) [[IRIS GL|IrisGL]] to its current open standard form OpenGL. When the decision was made to make IrisGL an open standard, the primary required design change was to make this graphics standard API windowing system agnostic. All window system specific logic was therefore removed from IrisGL when moving to OpenGL. Window system logic includes any event mechanism for gathering input from devices such as keyboards and mice, as well as any window ordering or sizing logic used when drawing to a modern windowed user interface. Further, all internal management of window memory buffers, sometimes referred to as surfaces, was also removed from IrisGL to create OpenGL.
 
With OpenGL windowing system agnostic, companies such as Apple must shoulder the burden of configuring and managing the surfaces used as a destination for OpenGL rendering.
With OpenGL windowing system agnostic, companies such as Apple must shoulder the burden of configuring and managing the surfaces used as a destination for OpenGL rendering. Configuration of these surfaces is done through a pixel format selection process where different compatible layers of rendering information are combined to form a framebuffer. Examples of such layers are color buffers, transparency buffers (alpha), stencil buffers, and depth buffers. The CGL function CGLChoosePixelFormat is used to perform this buffer compatibility check. CGLChoosePixelFormat will, based on input parameters and their scoring policy, choose a pixel format that represents a compatible buffer configuration that is supported by the underlying renderer that will be used to process graphics commands. Renderers may be either hardware based, such that they correspond to graphics cards installed in the system or they may be software based, where the main CPU of the system handles all of the graphics command processing and final rasterization work.
 
==Features==
On Mac OS X, CGL is also responsible for handling the heterogeneous nature of graphics device installations and configuration on Macintosh systems. Macintosh computers may have any number of displays and graphics cards installed in them. In these configurations, the users desktop may be virtualized (extended) or mirrored across multiple displays which are connected to multiple graphics cards which may or may not be from the same graphics vendor.
 
===Windowing system interfaces===
When users configure their Macintosh to use a virtualized desktop, and they drag windows from one display to another, CGL handles the management of OpenGL graphics state that must be shadowed between devices to provide command processing consistency between them. Dragging a window across a Macintosh desktop between two different displays that are supported by two different renderers is known as a "Virtual Screen Change".
On OS X, CGL is the foundation layer of windowing system interfaces to OpenGL. Both [[Apple Graphics Library|AGL]] (Apple OpenGLGraphics Library) and the [[Cocoa (API)]] (or AppKit) have interfaces to OpenGL and are logical software layers and depend on CGL for their behavior. CGL and AGL interoperate freely. CGL and Cocoa may be used together, however Cocoa classes may implicitly make changes to CGL state. Function calls from AGL and Cocoa should not be mixed.
 
With OpenGL windowing system agnostic, companies such as Apple must shoulder the burden of configuring and managing the surfaces used as a destination for OpenGL rendering. Configuration of these surfaces is done through a pixel format selection process where different compatible layers of rendering information are combined to form a [[framebuffer]]. Examples of such layers are color buffers, [[Alpha compositing|transparency buffers]] (alpha), [[stencil buffersbuffer]]s, and [[Z-buffering|depth buffers]]. The CGL function [https://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html#//apple_ref/c/func/CGLChoosePixelFormat CGLChoosePixelFormat] is used to perform this buffer compatibility check. CGLChoosePixelFormat will, based on input parameters and their scoring policy, choose a pixel format that represents a compatible buffer configuration that is supported by the underlying renderer that will be used to process graphics commands. [[Rendering (computer graphics)|Renderers]] may be either hardware based, such that they correspond to graphics cards installed in the system or they may be software based, where the main [[Central processing unit|CPU]] of the system handles all of the graphics command processing and final [[Rasterisation|rasterization]] work.
CGL also provides a mechanism to obtain information about the renderer that is currently in use. The primary data structure that maintains OpenGL state on Mac OS X is a CGLContextObj. These CGL contexts can be retrieved at any time using a call to CGLGetCurrentContext. The CGLContextObj may then be queried for specifics about the renderer that is associated with it.
 
===Handling Mac OS X heterogeneity===
On Mac OS X, CGL is also responsible for handling the heterogeneous nature of graphics device installations and configuration on Macintosh systems. Macintosh computers may have any number of displays and graphics cards installed in them. In these configurations, the usersuser's desktop may be virtualized (extended) or mirrored across multiple displays which are connected to multiple graphics cards which may or may not be from the same graphics vendor.
 
===Controlling the rendering===
When users configure their Macintosh to use a virtualized desktop, and they drag windows from one display to another, CGL handles the management of OpenGL graphics state that must be shadowed between devices to provide command processing consistency between them. Dragging a window across a Macintosh desktop between two different displays that are supported by two different renderers is known as a "Virtual Screen Change".
 
CGL also provides a mechanism to obtain information about the renderer that is currently in use. The primary data structure that maintains OpenGL state on Mac OS X is a [https://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html#//apple_ref/doc/c_ref/CGLContextObj CGLContextObj]. These CGL contexts can be retrieved at any time using a call to CGLGetCurrentContext[https://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html#//apple_ref/c/func/CGLGetCurrentContext CGLGetCurrentContext]. The ''CGLContextObj'' may then be queried for specifics about the renderer that is associated with it.
 
===Software renderer===
Also included is Apple's in-house OpenGL [[software renderer]]. Originally, this was a simple integer package. In Mac OS X 10.3, a new floating point one was introduced [https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/doc/uid/TP30001068-CH2g-AGLRenderingContextIDs which ultimately replaced it]. The software renderer, though slow, is fast enough for basic applications and [https://developer.apple.com/graphicsimaging/opengl/capabilities/index.html kept feature-complete] {{Webarchive|url=https://web.archive.org/web/20140108115648/https://developer.apple.com/graphicsimaging/opengl/capabilities/index.html |date=January 8, 2014 }} with OS X's OpenGL implementation for development purposes.
 
==See also==
*[[GLX]]: the equivalent [[X11]] interface to OpenGL
*[[WiggleWin32WGL (API)|WGL]]: the equivalent [[Mac OSMicrosoft XWindows]] interface to OpenGL
*[[Apple Graphics Library|AGL]]
*[[OpenGL]]
*[[OpenGL Utility Toolkit|GLUT]]: A higher level interface that hides the differences between WGL, GLX, etc.
 
==External links==
* [httphttps://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html CGL reference guide on Apple website (html).] - {{webarchive |url=https://web.archive.org/web/20140812200349/https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html |date=12 August 2014}}
* [https://developer.apple.com/documentation/GraphicsImaging/Reference/CGL_OpenGL/CGL_OpenGL.pdf CGL reference guide on Apple website (PDF).] - {{webarchive |url=https://web.archive.org/web/20140824204714/https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGL_OpenGL/CGL_OpenGL.pdf |date=24 August 2014}}
CGL_OpenGL.pdf CGL reference guide on Apple website]
 
{{Apple}}
{{Core Foundation}}
{{OS X}}
 
[[Category:3D computer graphics]]
[[Category:Application programming interfaces]]
[[Category:Graphics standards]]
[[Category:OpenGL]]