Files | |
file | ccGLStateCache.h |
Classes | |
class | CCGLProgram |
CCGLProgram Class that implements a glProgram. More... | |
class | CCShaderCache |
CCShaderCache Singleton that stores manages GL shaders. More... | |
Macros | |
#define | kCCShader_PositionTextureColor "ShaderPositionTextureColor" |
#define | kCCShader_PositionTextureColorAlphaTest "ShaderPositionTextureColorAlphaTest" |
#define | kCCShader_PositionColor "ShaderPositionColor" |
#define | kCCShader_PositionTexture "ShaderPositionTexture" |
#define | kCCShader_PositionTexture_uColor "ShaderPositionTexture_uColor" |
#define | kCCShader_PositionTextureA8Color "ShaderPositionTextureA8Color" |
#define | kCCShader_Position_uColor "ShaderPosition_uColor" |
#define | kCCShader_PositionLengthTexureColor "ShaderPositionLengthTextureColor" |
#define | kCCShader_ControlSwitch "Shader_ControlSwitch" |
#define | kCCUniformPMatrix_s "CC_PMatrix" |
#define | kCCUniformMVMatrix_s "CC_MVMatrix" |
#define | kCCUniformMVPMatrix_s "CC_MVPMatrix" |
#define | kCCUniformTime_s "CC_Time" |
#define | kCCUniformSinTime_s "CC_SinTime" |
#define | kCCUniformCosTime_s "CC_CosTime" |
#define | kCCUniformRandom01_s "CC_Random01" |
#define | kCCUniformSampler_s "CC_Texture0" |
#define | kCCUniformAlphaTestValue "CC_alpha_value" |
#define | kCCAttributeNameColor "a_color" |
#define | kCCAttributeNamePosition "a_position" |
#define | kCCAttributeNameTexCoord "a_texCoord" |
Typedefs | |
typedef void(* | GLInfoFunction )(GLuint program, GLenum pname, GLint *params) |
typedef void(* | GLLogFunction )(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog) |
Enumerations | |
enum | { kCCVertexAttrib_Position, kCCVertexAttrib_Color, kCCVertexAttrib_TexCoords, kCCVertexAttrib_MAX } |
enum | { kCCUniformPMatrix, kCCUniformMVMatrix, kCCUniformMVPMatrix, kCCUniformTime, kCCUniformSinTime, kCCUniformCosTime, kCCUniformRandom01, kCCUniformSampler, kCCUniform_MAX } |
enum | { kCCVertexAttribFlag_None = 0, kCCVertexAttribFlag_Position = 1 << 0, kCCVertexAttribFlag_Color = 1 << 1, kCCVertexAttribFlag_TexCoords = 1 << 2, kCCVertexAttribFlag_PosColorTex = ( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color | kCCVertexAttribFlag_TexCoords ) } |
vertex attrib flags More... | |
enum | ccGLServerState { CC_GL_ALL = 0 } |
GL server side states. More... | |
Functions | |
void CC_DLL | (void) |
Invalidates the GL state cache. More... | |
void CC_DLL | (GLuint program) |
Uses the GL program in case program is different than the current one. More... | |
void CC_DLL | (GLenum sfactor, GLenum dfactor) |
Uses a blending function in case it not already used. More... | |
void CC_DLL | (unsigned int flags) |
Will enable the vertex attribs that are passed as flags. More... | |
void CC_DLL | (GLuint textureUnit, GLuint textureId) |
If the texture is not already bound to a given unit, it binds it. More... | |
void CC_DLL | (ccGLServerState flags) |
It will enable / disable the server side GL states. More... | |
Variables | |
CC_DLL const GLchar * | ccPosition_uColor_frag |
CC_DLL const GLchar * | ccPosition_uColor_vert |
CC_DLL const GLchar * | ccPositionColor_frag |
CC_DLL const GLchar * | ccPositionColor_vert |
CC_DLL const GLchar * | ccPositionTexture_frag |
CC_DLL const GLchar * | ccPositionTexture_vert |
CC_DLL const GLchar * | ccPositionTextureA8Color_frag |
CC_DLL const GLchar * | ccPositionTextureA8Color_vert |
CC_DLL const GLchar * | ccPositionTextureColor_frag |
CC_DLL const GLchar * | ccPositionTextureColor_vert |
CC_DLL const GLchar * | ccPositionTextureColorAlphaTest_frag |
CC_DLL const GLchar * | ccPositionTexture_uColor_frag |
CC_DLL const GLchar * | ccPositionTexture_uColor_vert |
CC_DLL const GLchar * | ccPositionColorLengthTexture_frag |
CC_DLL const GLchar * | ccPositionColorLengthTexture_vert |
CC_DLL const GLchar * | ccExSwitchMask_frag |
#define kCCAttributeNameColor "a_color" |
#define kCCAttributeNamePosition "a_position" |
#define kCCAttributeNameTexCoord "a_texCoord" |
#define kCCShader_ControlSwitch "Shader_ControlSwitch" |
#define kCCShader_Position_uColor "ShaderPosition_uColor" |
#define kCCShader_PositionColor "ShaderPositionColor" |
#define kCCShader_PositionLengthTexureColor "ShaderPositionLengthTextureColor" |
#define kCCShader_PositionTexture "ShaderPositionTexture" |
#define kCCShader_PositionTexture_uColor "ShaderPositionTexture_uColor" |
#define kCCShader_PositionTextureA8Color "ShaderPositionTextureA8Color" |
#define kCCShader_PositionTextureColor "ShaderPositionTextureColor" |
#define kCCShader_PositionTextureColorAlphaTest "ShaderPositionTextureColorAlphaTest" |
#define kCCUniformAlphaTestValue "CC_alpha_value" |
#define kCCUniformCosTime_s "CC_CosTime" |
#define kCCUniformMVMatrix_s "CC_MVMatrix" |
#define kCCUniformMVPMatrix_s "CC_MVPMatrix" |
#define kCCUniformPMatrix_s "CC_PMatrix" |
#define kCCUniformRandom01_s "CC_Random01" |
#define kCCUniformSampler_s "CC_Texture0" |
#define kCCUniformSinTime_s "CC_SinTime" |
#define kCCUniformTime_s "CC_Time" |
typedef void(* GLInfoFunction)(GLuint program, GLenum pname, GLint *params) |
typedef void(* GLLogFunction)(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog) |
anonymous enum |
anonymous enum |
anonymous enum |
void CC_DLL cocos2d::ccGLInvalidateStateCache |
( | void | ) |
Invalidates the GL state cache.
If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
void CC_DLL cocos2d::ccGLUseProgram | ( | GLuint | program) |
Uses the GL program in case program is different than the current one.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
void CC_DLL cocos2d::ccGLBlendFunc | ( | GLenum | sfactor, |
GLenum | dfactor | ||
) |
Uses a blending function in case it not already used.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
void CC_DLL cocos2d::ccGLEnableVertexAttribs |
( | unsigned int | flags) |
Will enable the vertex attribs that are passed as flags.
Possible flags:
kCCVertexAttribFlag_Position kCCVertexAttribFlag_Color kCCVertexAttribFlag_TexCoords
These flags can be ORed. The flags that are not present, will be disabled.
void CC_DLL cocos2d::ccGLBindTexture2DN |
( | GLuint | textureUnit, |
GLuint | textureId | ||
) |
If the texture is not already bound to a given unit, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
void CC_DLL cocos2d::ccGLEnable | ( | ccGLServerState | flags) |
It will enable / disable the server side GL states.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glEnable() directly.