# eglQuerySurface

return EGL surface information

## C Specification

`EGLBoolean eglQuerySurface(` | EGLDisplay display,
| EGLSurface surface,
| EGLint attribute,
| EGLint * value`)`

## Parameters

`display`

  Specifies the EGL display connection.

`surface`

  Specifies the EGL surface to query.

`attribute`

  Specifies the EGL surface attribute to be returned.

`value`

  Returns the requested value.

## Description

`eglQuerySurface` returns in `value` the value of `attribute` for `surface`. `attribute` can be one of the following:

`EGL_CONFIG_ID`

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

`EGL_HEIGHT`

  Returns the height of the surface in pixels.

`EGL_HORIZONTAL_RESOLUTION`

  Returns the horizontal dot pitch of the display on which a window surface is visible. The value returned is equal to the actual dot pitch, in pixels/meter, multiplied by the constant value `EGL_DISPLAY_SCALING`.

`EGL_LARGEST_PBUFFER`

  Returns the same attribute value specified when the surface was created with eglCreatePbufferSurface. For a window or pixmap surface, `value` is not modified.

`EGL_MIPMAP_LEVEL`

  Returns which level of the mipmap to render to, if texture has mipmaps.

`EGL_MIPMAP_TEXTURE`

  Returns `EGL_TRUE` if texture has mipmaps, `EGL_FALSE` otherwise.

`EGL_MULTISAMPLE_RESOLVE`

  Returns the filter used when resolving the multisample buffer. The filter may be either `EGL_MULTISAMPLE_RESOLVE_DEFAULT` or `EGL_MULTISAMPLE_RESOLVE_BOX`, as described for eglSurfaceAttrib.

`EGL_PIXEL_ASPECT_RATIO`

  Returns the aspect ratio of an individual pixel (the ratio of a pixel's width to its height). The value returned is equal to the actual aspect ratio multiplied by the constant value `EGL_DISPLAY_SCALING`.

`EGL_RENDER_BUFFER`

  Returns the buffer which client API rendering is requested to use. For a window surface, this is the same attribute value specified when the surface was created. For a pbuffer surface, it is always `EGL_BACK_BUFFER`. For a pixmap surface, it is always `EGL_SINGLE_BUFFER`. To determine the actual buffer being rendered to by a context, call eglQueryContext.

`EGL_SWAP_BEHAVIOR`

  Returns the effect on the color buffer when posting a surface with eglSwapBuffers. Swap behavior may be either `EGL_BUFFER_PRESERVED` or `EGL_BUFFER_DESTROYED`, as described for eglSurfaceAttrib.

`EGL_TEXTURE_FORMAT`

  Returns format of texture. Possible values are `EGL_NO_TEXTURE`, `EGL_TEXTURE_RGB`, and `EGL_TEXTURE_RGBA`.

`EGL_TEXTURE_TARGET`

  Returns type of texture. Possible values are `EGL_NO_TEXTURE`, or `EGL_TEXTURE_2D`.

`EGL_VERTICAL_RESOLUTION`

  Returns the vertical dot pitch of the display on which a window surface is visible. The value returned is equal to the actual dot pitch, in pixels/meter, multiplied by the constant value `EGL_DISPLAY_SCALING`.

`EGL_WIDTH`

  Returns the width of the surface in pixels.

## Notes

Attribute `EGL_MULTISAMPLE_RESOLVE` is supported only if the EGL version is 1.4 or greater.

Attributes `EGL_DISPLAY_SCALING`. `EGL_HORIZONTAL_RESOLUTION`, `EGL_PIXEL_ASPECT_RATIO`, `EGL_RENDER_BUFFER`, `EGL_SWAP_BEHAVIOR`, and `EGL_VERTICAL_RESOLUTION` are supported only if the EGL version is 1.2 or greater.

Querying attributes `EGL_TEXTURE_FORMAT`, `EGL_TEXTURE_TARGET`, `EGL_MIPMAP_TEXTURE`, or `EGL_MIPMAP_LEVEL` for a non-pbuffer surface is not an error, but `value` is not modified.

`EGL_DISPLAY_SCALING` is the constant value 10000. Floating-point values such as resolution and pixel aspect ratio are scaled by this value before being returned as integers so that sufficient precision to be meaningful will be retained in the returned value.

For an offscreen (pbuffer or pixmap) surface, or a surface whose pixel dot pitch or aspect ratio are unknown, querying `EGL_HORIZONTAL_RESOLUTION`, `EGL_PIXEL_ASPECT_RATIO`, or `EGL_VERTICAL_RESOLUTION` will return the constant value `EGL_UNKNOWN` (-1).

## 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_SURFACE` is generated if `surface` is not an EGL surface.

`EGL_BAD_ATTRIBUTE` is generated if `attribute` is not a valid surface attribute.

## See Also

eglCreatePbufferSurface, eglCreatePixmapSurface, eglCreateWindowSurface, eglSurfaceAttrib, eglSwapBuffers

####

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.