cocos3d  2.0.0
Instance Methods | Class Methods | Properties | List of all members
CC3GLFramebuffer Class Reference

#import <CC3RenderSurfaces.h>

Inheritance diagram for CC3GLFramebuffer:
Inheritance graph
[legend]

Instance Methods

(id) - init
 
(id) - initWithSize:
 
(BOOL) - validate
 
- Instance Methods inherited from <CC3RenderSurface>
(void) - activate
 
(void) - clearColorAndDepthContent
 
(void) - clearColorContent
 
(void) - clearDepthContent
 
(void) - clearStencilContent
 
(CGImageRef) - createCGImage
 
(CGImageRef) - createCGImageFrom:
 
(void) - readColorContentFrom:into:
 
(void) - replaceColorPixels:withContent:
 
- Instance Methods inherited from <CC3Object>
(id) - asWeakReference
 
(NSString *) - fullDescription
 
(id) - resolveWeakReference
 

Class Methods

(id) + surface
 
(id) + surfaceWithSize:
 

Properties

id< CC3FramebufferAttachmentcolorAttachment
 
CC3TexturecolorTexture
 
id< CC3FramebufferAttachmentdepthAttachment
 
CC3TexturedepthTexture
 
GLuint framebufferID
 
BOOL isColorContentReadable
 
BOOL isOffScreen
 
CC3IntSize size
 
id< CC3FramebufferAttachmentstencilAttachment
 
- Properties inherited from <CC3RenderSurface>
id< CC3RenderSurfaceAttachmentcolorAttachment
 
id< CC3RenderSurfaceAttachmentdepthAttachment
 
BOOL isColorContentReadable
 
BOOL isOffScreen
 
CC3IntSize size
 
id< CC3RenderSurfaceAttachmentstencilAttachment
 

Detailed Description

Represents an OpenGL framebuffer.

Framebuffers hold between one and three attachments. Each attachment represents a rendering surface that holds a particular type of drawn content: color, depth, or stencil content. Typically, each of these attachments will be either a renderbuffer, a texture (to support rendering to a texture, or nil, indicating that that type of content is not being rendered.

Method Documentation

- (id) init

Initializes this instance with zero size.

- (id) initWithSize: (CC3IntSize size

Initializes this instance with the specified size.

When attachments are assigned to this surface, each will be resized to the specified size.

+ (id) surface

Allocates and initializes an autoreleased instance with zero size.

+ (id) surfaceWithSize: (CC3IntSize size

Allocations and initializes an autoreleased instance with the specified size.

When attachments are assigned to the instance, each will be resized to the specified size.

- (BOOL) validate

Implementation of the CC3RenderSurface validate method.

Validates that this framebuffer has a valid configuration in the GL engine.

This method should be invoked to validate the surface, once all attachments have been set or resized. If the configuration is not valid, an error is logged, and, if the GL_ERROR_ASSERTION_ENABLED compiler build setting is set, an assertion error is raised.

Reimplemented from <CC3RenderSurface>.

Property Documentation

- (id<CC3FramebufferAttachment>) colorAttachment
readwritenonatomicstrong

The attachment to which color data is rendered.

Implementation of the CC3RenderSurface colorAttachment property. Framebuffer attachments must also support the CC3FramebufferAttachment protocol.

When this property is set, if the size propery of this surface is not zero, and the attachment has no size, or has a size that is different than the size of this surface, the attachment is resized.

To save memory, attachments can be shared between surfaces of the same size, if the contents of the attachment are only required for the duration of the rendering to each surface.

- (CC3Texture*) colorTexture
readwritenonatomicstrong

If color content is being rendered to a texture, this property can be used to access that texture.

Setting this property wraps the specified texture in a CC3TextureFramebufferAttachment instance and sets it into the colorAttachment property.

When this property is set, if the size propery of this surface is not zero, and the texture has no size, or has a size that is different than the size of this surface, the texture is resized.

Reading this property returns the texture within the CC3TextureFramebufferAttachment in the colorAttachment property. It is an error to attempt to read this property if the depthAttachment property does not contain an instance of CC3TextureFramebufferAttachment.

To save memory, textures can be shared between surfaces of the same size, if the contents of the texture are only required for the duration of the rendering to each surface.

- (id<CC3FramebufferAttachment>) depthAttachment
readwritenonatomicstrong

The attachment to which depth data is rendered.

Implementation of the CC3RenderSurface depthAttachment property. Framebuffer attachments must also support the CC3FramebufferAttachment protocol.

When this property is set, if the size propery of this surface is not zero, and the attachment has no size, or has a size that is different than the size of this surface, the attachment is resized.

When this property is set, if the depth format of the attachment includes a stencil component, the stencilAttachment property is set to the this attachment as well.

To save memory, attachments can be shared between surfaces of the same size, if the contents of the attachment are only required for the duration of the rendering to each surface. For instance, the same depth attachment might be used when rendering to several different color attachments on different surfaces.

- (CC3Texture*) depthTexture
readwritenonatomicstrong

If depth content is being rendered to a texture, this property can be used to access that texture.

Setting this property wraps the specified texture in a CC3TextureFramebufferAttachment instance and sets it into the depthAttachment property, as well as the stencilAttachment property, if the depth format of the texture includes a stencil component.

When this property is set, if the size propery of this surface is not zero, and the texture has no size, or has a size that is different than the size of this surface, the texture is resized.

Reading this property returns the texture within the CC3TextureFramebufferAttachment in the depthAttachment property. It is an error to attempt to read this property if the depthAttachment property does not contain an instance of CC3TextureFramebufferAttachment.

To save memory, textures can be shared between surfaces of the same size, if the contents of the texture are only required for the duration of the rendering to each surface.

- (GLuint) framebufferID
readnonatomicassign

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

- (BOOL) isColorContentReadable
readnonatomicassign

Returns whether this surface supports reading the pixel content.

In general, the color content within a framebuffer is readable, and so this property always returns YES. Specialized subclasses with unreadable color content may override to return NO.

- (BOOL) isOffScreen
readnonatomicassign

Returns whether this surface is an off-screen surface.

Always returns YES. Subclasses that are used for on-screen rendering will override.

- (CC3IntSize) size
readnonatomicassign

The size of this framebuffer surface in pixels.

Returns the value of the same properties retrieved from any of the attachments (which must all have the same size for this framebuffer to be valid), or, if no attachments have been set, returns the value set during initialization.

It is not possible to resize the surface directly. To do so, resize each of the attachments separately. Because attachments may be shared between surfaces, management of attachment sizing is left to the application, to avoid resizing the same attachment more than once, during any single resizing activity.

- (id<CC3FramebufferAttachment>) stencilAttachment
readwritenonatomicstrong

The attachment to which stencil data is rendered.

Implementation of the CC3RenderSurface stencilAttachment property. Framebuffer attachments must also support the CC3FramebufferAttachment protocol.

When this property is set, if the size propery of this surface is not zero, and the attachment has no size, or has a size that is different than the size of this surface, the attachment is resized.

To save memory, attachments can be shared between surfaces of the same size, if the contents of the attachment are only required for the duration of the rendering to each surface.


The documentation for this class was generated from the following file: