v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3TextureFramebufferAttachment Class Reference

#import <CC3RenderSurfaces.h>

Inheritance diagram for CC3TextureFramebufferAttachment:
Inheritance graph
[legend]

Instance Methods

(instancetype) - initWithTexture:
 
(instancetype) - initWithTexture:usingFace:
 
(instancetype) - initWithTexture:usingFace:andLevel:
 
- Instance Methods inherited from <CC3FramebufferAttachment>
(void) - bindToFramebuffer:asAttachment:
 
(void) - deriveNameFromFramebuffer:asAttachment:
 
(void) - unbindFromFramebuffer:asAttachment:
 
- Instance Methods inherited from <CC3RenderSurfaceAttachment>
(void) - replacePixels:withContent:
 
- Instance Methods inherited from <CC3Object>
(id) - asWeakReference
 
(NSString *) - fullDescription
 
(id) - resolveWeakReference
 

Class Methods

(instancetype) + attachment
 
(instancetype) + attachmentWithTexture:
 
(instancetype) + attachmentWithTexture:usingFace:
 
(instancetype) + attachmentWithTexture:usingFace:andLevel:
 

Properties

GLenum face
 
GLint mipmapLevel
 
BOOL shouldUseStrongReferenceToTexture
 
CC3Texturetexture
 

Detailed Description

CC3TextureFramebufferAttachment is a framebuffer attachment that uses a texture as the rendering buffer.

Method Documentation

+ (instancetype) attachment

Allocates and initializes an autoreleased instance to render to mipmap level zero of an unspecified 2D texture.

The texture must be set using the texure property before rendering.

+ (instancetype) attachmentWithTexture: (CC3Texture *)  texture

Allocates and initializes an autoreleased instance to render to mipmap level zero of the specified 2D texture.

+ (instancetype) attachmentWithTexture: (CC3Texture *)  texture
usingFace: (GLenum)  face 

Allocates and initializes an autoreleased instance to render to mipmap level zero of the specified face of the specified texture.

+ (instancetype) attachmentWithTexture: (CC3Texture *)  texture
usingFace: (GLenum)  face
andLevel: (GLint)  mipmapLevel 

Allocates and initializes an autoreleased instance to render to the specified mipmap level of the specified face of the specified texture.

- (instancetype) initWithTexture: (CC3Texture *)  texture

Initializes this instance to render to mipmap level zero of the specified 2D texture.

- (instancetype) initWithTexture: (CC3Texture *)  texture
usingFace: (GLenum)  face 

Initializes this instance to render to mipmap level zero of the specified face of the specified texture.

- (instancetype) initWithTexture: (CC3Texture *)  texture
usingFace: (GLenum)  face
andLevel: (GLint)  mipmapLevel 

Initializes this instance to render to the specified mipmap level of the specified face of the specified texture.

Property Documentation

- (GLenum) face
readwritenonatomicassign

The target face within the texture into which rendering is to occur.

This property must be set prior to invoking the bindToFramebuffer:asAttachment: method.

For 2D textures, there is only one face, and this property should be set to GL_TEXTURE_2D.

For cube-map textures, this should be set to one of:

  • GL_TEXTURE_CUBE_MAP_POSITIVE_X
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_X
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Y
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
  • GL_TEXTURE_CUBE_MAP_POSITIVE_Z
  • GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

The initial value is set during initialization.

- (GLint) mipmapLevel
readwritenonatomicassign

The mipmap level of the texture into which rendering is to occur.

This property must be set prior to invoking the bindToFramebuffer:asAttachment: method.

The initial value is set during initialization.

- (BOOL) shouldUseStrongReferenceToTexture
readwritenonatomicassign

Indicates whether this attachment should create a strong reference to the texture in the texture property.

The initial value of this property is YES, indicating that the texture will be held as a strong reference, and in most cases, this is sufficient. However, in the case where this attachment is part of a surface that is, in turn, being held by the texture that is being rendered to (the contained texture), this attachment should maintain a weak reference to the texture, to avoid a retain cycle. Such a retain cycle would occur if this attachment holds a texture, that holds a surface, that, in turn, holds this attachment.

CC3EnvironmentMapTexture is an example of this design. CC3EnvironmentMapTexture holds a render surface that in turns holds the CC3EnvironmentMapTexture as the color attachment. CC3EnvironmentMapTexture automatically sets the shouldUseStrongReferenceToTexture property of the color texture attachment to NO, avoiding the retain cycle that would arise if the reference from the attachment to the texture was left as a strong reference.

If the texture property has already been set when this property is changed, the texture reference type is modified to comply with the new setting.

- (CC3Texture*) texture
readwritenonatomicassign

The texture to bind as an attachment to the framebuffer, and into which rendering will occur.

When the value of this property is set, both the horizontalWrappingFunction and verticalWrappingFunction properties of the texture will be set to GL_CLAMP_TO_EDGE, as required when using a texture as a rendering target.

The shouldUseStrongReferenceToTexture property determines whether the texture in this property will be held by a strong, or weak, reference.


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