The glGetString function returns a string describing the current OpenGL connection.

const GLubyte *glGetString(
  GLenum name


One of the following symbolic constants:
Constant Description
GL_VENDOR Returns the company responsible for this OpenGL implementation. This name does not change from release to release.
GL_RENDERER Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release.
GL_VERSION Returns a version or release number.
GL_EXTENSIONS Returns a space-separated list of supported extensions to OpenGL.


The glGetString function returns a pointer to a static string describing some aspect of the current OpenGL connection.

Because OpenGL does not include queries for the performance characteristics of an implementation, it is expected that some applications will be written to recognize known platforms and will modify their OpenGL usage based on known performance characteristics of these platforms. The strings GL_VENDOR and GL_RENDERER together uniquely specify a platform, and will not change from release to release. They should be used as such by platform recognition algorithms.

The format and contents of the string that glGetString returns depend on the implementation, except that:

  • Extension names will not include space characters and will be separated by space characters in the GL_EXTENSIONS string.
  • The GL_VERSION string begins with a version number. The version number uses one of these forms:



  • Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.
  • All strings are null-terminated.

If an error is generated, glGetString returns zero.

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_ENUM name was not an accepted value.
GL_INVALID_OPERATION glGetString was called between a call to glBegin and the corresponding call to glEnd.


  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glBegin, glEnd


Community Additions