Difference between revisions of "Get Context Info"

From OpenGL Wiki
Jump to navigation Jump to search
(Redirect to context info query section)
Line 1: Line 1:
#REDIRECT [[OpenGL Context#Context information queries]]
== OpenGL version number ==
To get the OpenGL major and minor version numbers, you can call these functions:
{{apifunc|glGetIntegerv}}({{enum|GL_MAJOR_VERSION}}, *);
{{apifunc|glGetIntegerv}}({{enum|GL_MINOR_VERSION}}, *);
These are available on OpenGL version 3.0 and above contexts. If those are not available, you can use this instead:
The string returned starts with "<nowiki><major version>.<minor version></nowiki>". Following the minor version, there can be another '.', then a vendor-specific build number. The string may have more content, which is completely vendor-specific (thus not a part of  the OpenGL standard).
For example, the returned string may be like "2.0.6914 WinXP  SSE/SSE2/SSE3/3DNow!". 2.0 is the actual version number of GL supported. 6914 is a driver build number. WinXP is the OS. SSE/SSE2/SSE3/3DNow! are CPU features that the driver can use.
Sometimes {{apifunc|glGetString|(GL_VERSION)}} also returns also the bus type used, such as AGP or PCI or PCIEx.
== Vendor string ==
The OpenGL implementations have a vendor string associated with it that is used for identifying the maker of the implementation.
It could be "ATI Technologies", "NVIDIA Corporation", "INTEL" and so on. Note that there's no guarantee that the string for a specific vendor will remain the same in future implementations. 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 in that case.
== Renderer name ==
This names the renderer used by the implementation.
This string is often the name of the GPU. In the case of Mesa3d, it would be i.e "Gallium 0.4 on NVA8". It might even say "Direct3D" if the Windows Direct3D wrapper is being used.
== Extension list ==
Extensions can be queried one by one. To do this, first use {{apifunc|glGetIntegerv|(GL_NUM_EXTENSIONS, *)}} to get the number of extensions supported by the implementation. Then iterate over each one with this:
{{apifunc|glGetString|i}}({{enum|GL_EXTENSIONS}}, k);
Where {{param|k}} is less than the {{enum|GL_NUM_EXTENSIONS}} value.
=== Legacy extension list ===
A string containing a space-separated list of extension names can be queried as follows:
== Shading language version ==
The primary version of GLSL supported by the implementation can be queried:
The version string has almost the same format as the context version string. The difference is that the minor version always has two digits.
=== Supported GLSL versions ===
{{infobox feature
| name = Supported GLSL versions
| core = 4.3
Support for specific versions of GLSL can be queried via an indexed get. The number of supported GLSL versions is queried with {{apifunc|glGetIntegerv|(GL_NUM_SHADING_LANGUAGE_VERSIONS, *)​}}. Each individual version can be queried from an indexed string:
{{clear float}}
{{apifunc|glGetString|i}}({{enum|GL_SHADING_LANGUAGE_VERSION​}}, k);
Where {{param|k}} is on the range 0 to {{enum|GL_NUM_SHADING_LANGUAGE_VERSIONS}} - 1.
These strings use the formatting of GLSL's [[Version Declaration|{{code|#version}} declaration]]. This has the following forms:
  {{param|number}} {{param|profile}}
The {{param|profile}} is only present for versions of GLSL that have this distinction.
Note that GLSL only gained the {{code|#version}} declaration in version 1.10; if an implementation exposes support for GLSL 1.00 (through {{extref|shading_language_100}}), then it will return an empty string ("").
Versions of the GLSL for OpenGL ES can also be supported. If an implementation returns "100", this does not refer to GLSL 1.00. It instead refers to support for OpenGL ES's 2.0's GLSL ES version 1.00. The {{param|profile}} can also be "es", which represents a version of OpenGL ES's shading language. So version "300 es" represents GLSL ES 3.00. GLSL ES 1.00 does not use the "es" profile name.
[[Category:General OpenGL]]

Latest revision as of 03:38, 11 September 2017