Difference between revisions of "Get Context Info"

From OpenGL.org
Jump to: navigation, search
(Removed GLH nonsense.)
(Marking deprecated.)
Line 20: Line 20:
  
 
=== glGetString(GL_EXTENSIONS) ===
 
=== glGetString(GL_EXTENSIONS) ===
 +
 +
{{deprecated|alternate = glglGetStringi(GL_EXTENSIONS, i)}}
  
 
The use of glGetString with GL_EXTENSIONS is deprecated in OpenGL 3.0 and removed in the core profiles of OpenGL 3.1 and above.
 
The use of glGetString with GL_EXTENSIONS is deprecated in OpenGL 3.0 and removed in the core profiles of OpenGL 3.1 and above.
Line 26: Line 28:
  
 
For example, if the extension <code>GL_EXT_pixel_transform_color_table</code> is listed, doing a simple search for GL_EXT_pixel_transform will return a positive whether or not it is defined.
 
For example, if the extension <code>GL_EXT_pixel_transform_color_table</code> is listed, doing a simple search for GL_EXT_pixel_transform will return a positive whether or not it is defined.
 
GL 3.0 and above include the entrypoint, <code>glGetStringi</code> for getting extension names.
 
  
 
=== glGetStringi(GL_EXTENSIONS, i) ===
 
=== glGetStringi(GL_EXTENSIONS, i) ===

Revision as of 15:51, 19 August 2009

glGetString(GL_VERSION)

This returns a string which may look something like "2.0.6914 WinXP SSE/SSE2/SSE3/3DNow!"

2.0 is the actual version number of GL supported. All the rest depends on what information the IHV wants to convey and is not part of the GL standard. 6914 would be the driver version. WinXP is the OS. SSE/SSE2/SSE3/3DNow! are CPU features that the driver can use in case it runs in software mode.

Also note that at times glGetString(GL_VERSION) returns also the bus type used such as AGP or PCI or PCIEx.

glGetString(GL_VENDOR)

This returns the company name of whoever wrote the GL driver. It could be "ATI Technologies", "NVIDIA", "INTEL" and so on.

On Windows, if it says "Microsoft" then you are using the Windows software renderer or the Windows Direct3D wrapper. You probably haven't installed the graphics drivers yet.

glGetString(GL_RENDERER)

This returns the name of the renderer, which would be the name of the GPU. In the case of Mesa, the software renderer, it would be "Mesa" or "MESA". It might even say "Direct3D" if the Windows Direct3D wrapper is being used.

glGetString(GL_EXTENSIONS)

The use of glGetString with GL_EXTENSIONS is deprecated in OpenGL 3.0 and removed in the core profiles of OpenGL 3.1 and above.

This function used to be used to retrieve the list of extensions. This is a space-separated list of extension names. This was problematic because of poor parsing behavior. Some programs searched this string for the name of the extension. It is not the correct way to find if an extension is supported, as it is prone to the following error.

For example, if the extension GL_EXT_pixel_transform_color_table is listed, doing a simple search for GL_EXT_pixel_transform will return a positive whether or not it is defined.

glGetStringi(GL_EXTENSIONS, i)

This function retrieves the null-terminated string of the 'i'th extension. An implementation exposes a number of extensions equal to glGetInteger(GL_NUM_EXTENSIONS). The argument 'i' must be between 0 and this value - 1.

This entrypoint is supported only in GL 3.0 and above.