glRenderbufferStorage

3G

glRenderbufferStorage

create and initialize a renderbuffer object's data store

# C Specification

    		void glRenderbufferStorage
    		GLenum target
    		GLenum internalformat
    		GLsizei width
    		GLsizei height

## Parameters

`target`

- Specifies the renderbuffer target. The symbolic constant must be `GL_RENDERBUFFER`.

`internalformat`

- Specifies the color-renderable, depth-renderable, or stencil-renderable format of the renderbuffer. Must be one of the following symbolic constants: `GL_RGBA4`, `GL_RGB565`, `GL_RGB5_A1`, `GL_DEPTH_COMPONENT16`, or `GL_STENCIL_INDEX8`.

`width`

- Specifies the width of the renderbuffer in pixels.

`height`

- Specifies the height of the renderbuffer in pixels.

## Description

`glRenderbufferStorage` establishes the data storage, format, and dimensions of a renderbuffer object's image. Any existing data store for the renderbuffer is deleted and the contents of the new data store are undefined.

An implementation may vary its allocation of internal component resolution based on any `glRenderbufferStorage` parameter (except `target`), but the allocation and chosen internal format must not be a function of any other state and cannot be changed once they are established. The actual resolution in bits of each component of the allocated image can be queried with

glGetRenderbufferParameteriv

.

## Errors

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

`GL_INVALID_ENUM` is generated if `internalformat` is not an accepted format.

`GL_INVALID_VALUE` is generated if `width` or `height` is less than zero or greater than `GL_MAX_RENDERBUFFER_SIZE`.

`GL_OUT_OF_MEMORY` is generated if the implementation is unable to create a data store with the requested `width` and `height`.

`GL_INVALID_OPERATION` is generated if the reserved renderbuffer object name 0 is bound.

## Associated Gets

glGetRenderbufferParameteriv

## See Also

glBindRenderbuffer

,

glDeleteRenderbuffers

,

glFramebufferRenderbuffer

,

glGenRenderbuffers

,

glGetRenderbufferParameteriv

,

glIsRenderbuffer

## Copyright

Copyright 2008 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/.