CCRenderState Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in CCRendererBasicTypes.h

Overview

A render state encapsulates how an object will be drawn. For example what shader it will use, the texture, the blending mode, etc.

Creating a Custom Render State

+ renderStateWithBlendMode:shader:mainTexture:

Creates a cached blending mode for a given blending mode, shader and main texture.

+ (instancetype)renderStateWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader mainTexture:(CCTexture *)mainTexture

Parameters

blendMode

A blend mode.

shader

The shader to use.

mainTexture

The mainTexture to use.

Declared In

CCRendererBasicTypes.h

+ renderStateWithBlendMode:shader:shaderUniforms:copyUniforms:

Creates an uncached blending mode for a given blending mode, shader and set of uniform values. Allowing the uniform dictionary to be copied allows the render state to be immutable, which is more efficient.

+ (instancetype)renderStateWithBlendMode:(CCBlendMode *)blendMode shader:(CCShader *)shader shaderUniforms:(NSDictionary *)shaderUniforms copyUniforms:(BOOL)copyUniforms

Parameters

blendMode

A blend mode.

shader

The shader to use.

shaderUniforms

The shader uniforms.

copyUniforms

Whether to copy the uniforms. If set to YES the render state is assumed to be immutable which is more efficient.

Declared In

CCRendererBasicTypes.h

Obtaining the Debug Render State

+ debugColor

A simple render state you can use that draws solid colors.

+ (instancetype)debugColor

Declared In

CCRendererBasicTypes.h