eglQueryContext - EGL Reference Pages

## Name

eglQueryContext — return EGL rendering context information

## C Specification

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

## Parameters

`display`

  Specifies the EGL display connection.

`context`

  Specifies the EGL rendering context to query.

`attribute`

  Specifies the EGL rendering context attribute to be returned.

`value`

  Returns the requested value.

## Description

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

`EGL_CONFIG_ID`

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

`EGL_CONTEXT_CLIENT_TYPE`

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

`EGL_CONTEXT_CLIENT_VERSION`

  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.

`EGL_RENDER_BUFFER`

  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.

## Notes

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.

## Errors

`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

eglCreateContext

Copyright © 2003-2014 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.