CC3TextureFramebufferAttachment Class Reference
Inherits from | NSObject |
Conforms to | CC3FramebufferAttachment |
Declared in | CC3RenderSurfaces.h |
Overview
CC3TextureFramebufferAttachment is a framebuffer attachment that uses a texture as the rendering buffer.
Properties
face
The target face within the texture into which rendering is to occur.
@property (nonatomic, assign) GLenum face
Discussion
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.
Declared In
CC3RenderSurfaces.h
mipmapLevel
The mipmap level of the texture into which rendering is to occur.
@property (nonatomic, assign) GLint mipmapLevel
Discussion
This property must be set prior to invoking the bindToFramebuffer:asAttachment: method.
The initial value is set during initialization.
Declared In
CC3RenderSurfaces.h
shouldUseStrongReferenceToTexture
Indicates whether this attachment should create a strong reference to the texture in the texture property.
@property (nonatomic, assign) BOOL shouldUseStrongReferenceToTexture
Discussion
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.
Declared In
CC3RenderSurfaces.h
texture
The texture to bind as an attachment to the framebuffer, and into which rendering will occur.
@property (nonatomic, assign) CC3Texture *texture
Discussion
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.
Declared In
CC3RenderSurfaces.h
Class Methods
attachment
Allocates and initializes an autoreleased instance to render to mipmap level zero of an unspecified 2D texture.
+ (instancetype)attachment
Discussion
The texture must be set using the texure property before rendering.
Declared In
CC3RenderSurfaces.h
attachmentWithTexture:
Allocates and initializes an autoreleased instance to render to mipmap level zero of the specified 2D texture.
+ (instancetype)attachmentWithTexture:(CC3Texture *)texture
Declared In
CC3RenderSurfaces.h
attachmentWithTexture:usingFace:
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
Declared In
CC3RenderSurfaces.h
attachmentWithTexture:usingFace:andLevel:
Allocates and initializes an autoreleased instance to render to the specified mipmap level of the specified face of the specified texture.
+ (instancetype)attachmentWithTexture:(CC3Texture *)texture usingFace:(GLenum)face andLevel:(GLint)mipmapLevel
Declared In
CC3RenderSurfaces.h
Instance Methods
initWithTexture:
Initializes this instance to render to mipmap level zero of the specified 2D texture.
- (instancetype)initWithTexture:(CC3Texture *)texture
Declared In
CC3RenderSurfaces.h