eglQueryContext — return EGL rendering context information

C Specification

EGLBoolean eglQueryContext( EGLDisplay display,
  EGLContext context,
  EGLint attribute,
  EGLint * value);



Specifies the EGL display connection.


Specifies the EGL rendering context to query.


Specifies the EGL rendering context attribute to be returned.


Returns the requested value.


eglQueryContext returns in value the value of attribute for context. attribute can be one of the following:


Returns the ID of the EGL frame buffer configuration with respect to which the context was created.


Returns the type of client API which the context supports (one of EGL_OPENGL_API, EGL_OPENGL_ES_API, or EGL_OPENVG_API).


Returns the version of the client API which the context supports, as specified at context creation time. The resulting value is only meaningful for an OpenGL ES context.


Returns the buffer which client API rendering via the context will use. The value returned depends on properties of both the context, and the surface to which the context is bound:

  • If the context is bound to a pixmap surface, then EGL_SINGLE_BUFFER will be returned.

  • If the context is bound to a pbuffer surface, then EGL_BACK_BUFFER will be returned.

  • If the context is bound to a window surface, then either EGL_BACK_BUFFER or EGL_SINGLE_BUFFER may be returned. The value returned depends on both the buffer requested by the setting of the EGL_RENDER_BUFFER property of the surface (which may be queried by calling eglQuerySurface), and on the client API (not all client APIs support single-buffer rendering to window surfaces).

  • If the context is not bound to a surface, such as an OpenGL ES context bound to a framebuffer object, then EGL_NONE will be returned.


Attributes EGL_CONTEXT_CLIENT_TYPE and EGL_RENDER_BUFFER are supported only if the EGL version is 1.2 or greater.

Attribute EGL_CONTEXT_CLIENT_VERSION is supported only if the EGL version is 1.3 or greater.


EGL_FALSE is returned on failure, EGL_TRUE otherwise. value is not modified when EGL_FALSE is returned.

EGL_BAD_DISPLAY is generated if display is not an EGL display connection.

EGL_NOT_INITIALIZED is generated if display has not been initialized.

EGL_BAD_CONTEXT is generated if context is not an EGL rendering context.

EGL_BAD_ATTRIBUTE is generated if attribute is not a valid context attribute.

See Also