glFramebufferTexture - OpenGL ES 3.2 Reference Pages

## Name

glFramebufferTexture — attach a level of a texture object as a logical buffer of a framebuffer object

## C Specification

`void glFramebufferTexture(` | GLenum target,
| GLenum attachment,
| GLuint texture,
| GLint level`)`;

## Parameters

`target`

  Specifies the target to which the framebuffer is bound.

`attachment`

  Specifies the attachment point of the framebuffer.

`texture`

  Specifies the name of an existing texture object to attach.

`level`

  Specifies the mipmap level of the texture object to attach.

## Description

`glFramebufferTexture` attaches a selected mipmap level or image of a texture object as one of the logical buffers of the framebuffer object bound to the specified target. Textures cannot be attached to the default draw and read framebuffer, so they are not valid targets of these commands.

The framebuffer object is that bound to `target`, which must be `GL_DRAW_FRAMEBUFFER`, `GL_READ_FRAMEBUFFER`, or `GL_FRAMEBUFFER`. `GL_FRAMEBUFFER` is equivalent to `GL_DRAW_FRAMEBUFFER`.

`attachment` specifies the logical attachment of the framebuffer and must be `GL_COLOR_ATTACHMENT`i, `GL_DEPTH_ATTACHMENT`, `GL_STENCIL_ATTACHMENT` or `GL_DEPTH_STENCIL_ATTACHMENT`. i in `GL_COLOR_ATTACHMENT`i may range from zero to the value of `GL_MAX_COLOR_ATTACHMENTS` minus one. Attaching a level of a texture to `GL_DEPTH_STENCIL_ATTACHMENT` is equivalent to attaching that level to both the `GL_DEPTH_ATTACHMENT` and the `GL_STENCIL_ATTACHMENT` attachment points simultaneously.

If `texture` is non-zero, the specified `level` of the texture object named `texture` is attached to the framebuffer attachment point named by `attachment`.

If `texture` is a multisampled texture, then `level` must be zero.

If `texture` is a 3D texture, then `level` must be greater than or equal to zero and less than or equal to $log_2$ of the value of `GL_MAX_3D_TEXTURE_SIZE`.

If `texture` is a cube-mapped texture, then `level` must be greater than or equal to zero and less than or equal to $log_2$ of the value of `GL_MAX_CUBE_MAP_TEXTURE_SIZE`.

For all other texture types, `level` must be greater than or equal to zero and less than or equal to $log_2$ of the value of `GL_MAX_TEXTURE_SIZE`.

If `texture` is the name of a three-dimensional, cube map array, cube map, two-dimensional array, or two-dimensional multisample array texture, the specified texture level is an array of images, and the framebuffer attachment is considered to be layered and `GL_FRAMEBUFFER_ATTACHMENT_LAYERED` is set to true.

## Errors

`GL_INVALID_ENUM` is generated if `target` if it is not `GL_DRAW_FRAMEBUFFER`, `GL_READ_FRAMEBUFFER`, or `GL_FRAMEBUFFER`

`GL_INVALID_OPERATION` is generated if zero is bound to `target`.

`GL_INVALID_ENUM` is generated if `attachment` is not one of the accepted attachment points.

`GL_INVALID_VALUE` is generated if `texture` is not zero or the name of an existing texture object.

`GL_INVALID_VALUE` is generated if `texture` is not zero and `level` is not a supported texture level for `texture`.

`GL_INVALID_OPERATION` is generated by if `texture` is a buffer texture.

## Version Support

| OpenGL ES API Version
--- | ---
Function Name | 2.0 | 3.0 | 3.1 | 3.2
`glFramebufferTexture` | - | - | - | ✔

## See Also

glGenFramebuffers, glBindFramebuffer, glGenRenderbuffers, glFramebufferTextureLayer, glFramebufferTexture2D

## Copyright

Copyright © 2010-2015 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. http://opencontent.org/openpub/.