Inherits from CC3Identifiable : NSObject
Conforms to CC3FramebufferAttachment
Declared in CC3RenderSurfaces.h

Overview

Represents an OpenGL renderbuffer.

CC3GLRenderbuffer implements the CC3FramebufferAttachment, allowing it to be attached to a framebuffer. This class represents a general off-screen or on-screen GL renderbuffer, whose storage is allocated from GL memory.

Broadly speaking, there are two ways to instantiate an instance and manage the lifespan of the corresponding renderbuffer in the GL engine, these are described as follows.

If you instantiate an instance without explicitly providing the ID of an existing OpenGL renderbuffer, a renderbuffer will automatically be created within the GL engine, as needed, and will automatically be deleted from the GL engine when the instance is deallocated.

To map to an existing OpenGL renderbuffer, you can provide the value of the renderbufferID property during instance instantiation. In this case, the instance will not delete the renderbuffer from the GL engine when the instance is deallocated, and it is up to you to coordinate the lifespan of the instance and the GL renderbuffer. Do not use the instance once you have deleted the renderbuffer from the GL engine.

Properties

isManagingGL

Returns whether the renderbuffer in the GL engine is being managed by this instance.

@property (nonatomic, readonly) BOOL isManagingGL

Discussion

If the value of this property is YES, this instance is managing the renderbuffer in the GL engine, and when this instance is deallocated, the renderbuffer will automatically be deleted from the GL engine.

If the value of this property is NO, this instance is NOT managing the renderbuffer in the GL engine, and when this instance is deallocated, the renderbuffer will NOT automatically be deleted from the GL engine.

If the value of this property is NO, indicating the lifespan of the GL renderbuffer is not managed by this instance, it is up to you to coordinate the lifespan of this instance and the GL renderbuffer. Do not use this instance once you have deleted the renderbuffer from the GL engine.

The value of this property also has an effect on the behaviour of the size property. If this property returns YES, setting the size property will also resize the memory allocation in the GL engine. If this property returns NO, setting the size property has no effect on the memory allocation in the GL engine.

If this instance is initialized with with a specific value for the renderbufferID property, the value of this property will be NO, otherwise, the value of this property will be YES.

Declared In

CC3RenderSurfaces.h

pixelFormat

Returns the format of each pixel in the buffer.

@property (nonatomic, readonly) GLenum pixelFormat

Discussion

The returned value may be one of the following: – GL_RGB8 – GL_RGBA8 – GL_RGBA4 – GL_RGB5_A1 – GL_RGB565 – GL_DEPTH_COMPONENT16 – GL_DEPTH_COMPONENT24 – GL_DEPTH24_STENCIL8 – GL_STENCIL_INDEX8

Declared In

CC3RenderSurfaces.h

pixelSamples

Returns the number of samples used to define each pixel.

@property (nonatomic, readonly) GLuint pixelSamples

Declared In

CC3RenderSurfaces.h

renderbufferID

The ID used to identify the renderbuffer to the GL engine.

@property (nonatomic, readonly) GLuint renderbufferID

Discussion

If the value of this property is not explicitly set during instance initialization, then the first time this property is accessed a renderbuffer will automatically be generated in the GL engine, and its ID set into this property.

Declared In

CC3RenderSurfaces.h

size

The size of this renderbuffer in pixels.

@property (nonatomic, assign) CC3IntSize size

Discussion

When the value of this property is changed, if the isManagingGL property returns YES, storage space within GL memory is allocated or reallocated. If the isManagingGL property returns NO, the memory allocation in the GL engine remains unchanged, but the value of this property will reflect the new value.

Declared In

CC3RenderSurfaces.h

Class Methods

renderbuffer

Allocates and initializes an autoreleased instance with one sample per pixel.

+ (instancetype)renderbuffer

Declared In

CC3RenderSurfaces.h

renderbufferWithPixelFormat:

Allocates and initializes an autoreleased instance with the specified pixel format and with one sample per pixel.

+ (instancetype)renderbufferWithPixelFormat:(GLenum)format

Discussion

See the pixelFormat property for allowable values for the format parameter.

Declared In

CC3RenderSurfaces.h

renderbufferWithPixelFormat:withPixelSamples:

Allocates and initializes an autoreleased instance with the specified pixel format and number of samples per pixel.

+ (instancetype)renderbufferWithPixelFormat:(GLenum)format withPixelSamples:(GLuint)samples

Discussion

See the pixelFormat property for allowable values for the format parameter.

Declared In

CC3RenderSurfaces.h

renderbufferWithPixelFormat:withPixelSamples:withRenderbufferID:

Allocates and initializes an autoreleased instance with the specified pixel format, number of samples per pixel, and renderbuffer ID.

+ (instancetype)renderbufferWithPixelFormat:(GLenum)format withPixelSamples:(GLuint)samples withRenderbufferID:(GLuint)rbID

Discussion

See the pixelFormat property for allowable values for the format parameter.

The value of the isManagingGL property of the returned instance will be set to NO, indicating that the instance will not delete the renderbuffer from the GL engine when the returned instance is deallocated. It is up to you to coordinate the lifespan of the returned instance and the GL renderbuffer. Do not use the returned instance once you have deleted the renderbuffer from the GL engine.

Declared In

CC3RenderSurfaces.h

renderbufferWithPixelFormat:withRenderbufferID:

Allocates and initializes an autoreleased instance with the specified pixel format, and renderbuffer ID.

+ (instancetype)renderbufferWithPixelFormat:(GLenum)format withRenderbufferID:(GLuint)rbID

Discussion

See the pixelFormat property for allowable values for the format parameter.

The value of the isManagingGL property of the returned instance will be set to NO, indicating that the instance will not delete the renderbuffer from the GL engine when the returned instance is deallocated. It is up to you to coordinate the lifespan of the returned instance and the GL renderbuffer. Do not use the returned instance once you have deleted the renderbuffer from the GL engine.

Declared In

CC3RenderSurfaces.h

Instance Methods

bind

Binds this renderbuffer as the active renderbuffer in the GL engine.

- (void)bind

Declared In

CC3RenderSurfaces.h

initWithPixelFormat:

Initializes this instance with the specified pixel format and with one sample per pixel.

- (instancetype)initWithPixelFormat:(GLenum)format

Discussion

See the pixelFormat property for allowable values for the format parameter.

Declared In

CC3RenderSurfaces.h

initWithPixelFormat:withPixelSamples:

Initializes this instance with the specified pixel format and with number of samples per pixel.

- (instancetype)initWithPixelFormat:(GLenum)format withPixelSamples:(GLuint)samples

Discussion

See the pixelFormat property for allowable values for the format parameter.

Declared In

CC3RenderSurfaces.h

initWithPixelFormat:withPixelSamples:withRenderbufferID:

Initializes this instance with the specified pixel format, number of samples per pixel, and renderbuffer ID.

- (instancetype)initWithPixelFormat:(GLenum)format withPixelSamples:(GLuint)samples withRenderbufferID:(GLuint)rbID

Discussion

See the pixelFormat property for allowable values for the format parameter.

The value of the isManagingGL property will be set to NO, indicating that this instance will not delete the renderbuffer from the GL engine when this instance is deallocated. It is up to you to coordinate the lifespan of this instance and the GL renderbuffer. Do not use this instance once you have deleted the renderbuffer from the GL engine.

Declared In

CC3RenderSurfaces.h

initWithPixelFormat:withRenderbufferID:

Initializes this instance with the specified pixel format and renderbuffer ID.

- (instancetype)initWithPixelFormat:(GLenum)format withRenderbufferID:(GLuint)rbID

Discussion

See the pixelFormat property for allowable values for the format parameter.

The value of the isManagingGL property will be set to NO, indicating that this instance will not delete the renderbuffer from the GL engine when this instance is deallocated. It is up to you to coordinate the lifespan of this instance and the GL renderbuffer. Do not use this instance once you have deleted the renderbuffer from the GL engine.

Declared In

CC3RenderSurfaces.h