Light | Dark

# docs.GL

OpenGL 4
OpenGL ES 3

# glInvalidateFramebuffer

## Name

glInvalidateFramebuffer — Invalidate the contents of attachments within a framebuffer

## C Specification

`void glInvalidateFramebuffer(` | GLenum target,
| GLsizei numAttachments,
| const GLenum *attachments`)`;

## Parameters

`target`

  Specifies the target of the invalidate operation. Must be `GL_FRAMEBUFFER`.

`numAttachments`

  Specifies how many attachments are supplied in the `attachments` list.

`attachments`

  A list of `numAttachments` attachments to invalidate.

## Description

`glInvalidateFramebuffer` signals to the GL that it need not preserve all pixels of a bound framebuffer object. `attachments` contains a list of `numAttachments` to be invalidated. If an attachment is specified that does not exist in the bound framebuffer, it is ignored.

If a framebuffer object is bound, then `attachments` may contain `GL_COLOR_ATTACHMENTi`, `GL_DEPTH_ATTACHMENT`, `GL_STENCIL_ATTACHMENT`, and/or `GL_DEPTH_STENCIL_ATTACHMENT`. If the framebuffer object is not complete, `glInvalidateFramebuffer` may be ignored.

If the default framebuffer is bound, then `attachments` may contain `GL_COLOR`, identifying the color buffer; `GL_DEPTH`, identifying the depth buffer; and/or `GL_STENCIL`, identifying the stencil buffer.

## Notes

The intention of this function is to provide a hint to the GL implementation that there is no longer a need to preserve the contents of particular attachments of a framebuffer object, or the default framebuffer. It is possible, for example, to signal the intention that depth and or stencil data is no longer needed at the end of a scene, or that multisample color buffer data is no longer needed after a resolve through glBlitFramebuffer.

## Errors

`GL_INVALID_ENUM` is generated if `target` is not `GL_FRAMEBUFFER`.

`GL_INVALID_OPERATION` is generated if `attachments` contains `GL_COLOR_ATTACHMENTm` and m is greater than or equal to the value of `GL_MAX_COLOR_ATTACHMENTS`.

## API Version Support

| OpenGL ES API Version
--- | ---
Function Name | 2.0 | 3.0 | 3.1
glInvalidateFramebuffer | - | ✔ | ✔

## See Also

glBindFramebuffer, glBlitFramebuffer glFramebufferRenderbuffer, glFramebufferTexture2D, glFramebufferTextureLayer, glInvalidateSubFramebuffer

## Copyright

Copyright © 2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.