2003-2014 The Khronos Group Inc.
eglSurfaceAttrib 3G
eglSurfaceAttrib set an EGL surface attribute

## C Specification

EGLBoolean `eglSurfaceAttrib` EGLDisplay display EGLSurface surface EGLint attribute EGLint value

## Parameters

display

  Specifies the EGL display connection.

surface

  Specifies the EGL surface.

attribute

  Specifies the EGL surface attribute to set.

value

  Specifies the attributes required value.

## Description

`eglSurfaceAttrib` sets the value of attribute for surface to value. attribute can be one of the following:

`EGL_MIPMAP_LEVEL`

  For mipmap textures, the `EGL_MIPMAP_LEVEL` attribute indicates which level of the mipmap should be rendered. If the value of this attribute is outside the range of supported mipmap levels, the closest valid mipmap level is selected for rendering. The default value is `0`.

`EGL_MULTISAMPLE_RESOLVE`

  Specifies the filter to use when resolving the multisample buffer (this may occur when swapping or copying the surface, or when changing the client API context bound to the surface). A value of `EGL_MULTISAMPLE_RESOLVE_DEFAULT` chooses the default implementation-defined filtering method, while `EGL_MULTISAMPLE_RESOLVE_BOX` chooses a one-pixel wide box filter placing equal weighting on all multisample values.

  The initial value of `EGL_MULTISAMPLE_RESOLVE` is `EGL_MULTISAMPLE_RESOLVE_DEFAULT`.

`EGL_SWAP_BEHAVIOR`

  Specifies the effect on the color buffer of posting a surface with eglSwapBuffers. A value of `EGL_BUFFER_PRESERVED` indicates that color buffer contents are unaffected, while `EGL_BUFFER_DESTROYED` indicates that color buffer contents may be destroyed or changed by the operation.

  The initial value of `EGL_SWAP_BEHAVIOR` is chosen by the implementation.

## Notes

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

Attribute `EGL_SWAP_BEHAVIOR` is supported only if the EGL version is 1.2 or greater.

If the value of pbuffer attribute `EGL_TEXTURE_FORMAT` is `EGL_NO_TEXTURE`, the value of attribute `EGL_TEXTURE_TARGET` is `EGL_NO_TEXTURE`, or surface is not a pbuffer, then attribute `EGL_MIPMAP_LEVEL` may be set, but has no effect.

## Errors

`EGL_FALSE` is returned on failure, `EGL_TRUE` otherwise.

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

`EGL_BAD_MATCH` is generated if attribute is `EGL_MULTISAMPLE_RESOLVE`, value is `EGL_MULTISAMPLE_RESOLVE_BOX`, and the `EGL_SURFACE_TYPE` attribute of the EGLConfig used to create surface does not contain `EGL_MULTISAMPLE_RESOLVE_BOX_BIT`.

`EGL_BAD_MATCH` is generated if attribute is `EGL_SWAP_BEHAVIOR`, value is `EGL_BUFFER_PRESERVED`, and the `EGL_SURFACE_TYPE` attribute of the EGLConfig used to create surface does not contain `EGL_SWAP_BEHAVIOR_PRESERVED_BIT`.

`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, eglQuerySurface

##