cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
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 | ccGLInvalidateStateCache (void) |
Invalidates the GL state cache. More... | |
void CC_DLL | ccGLUseProgram (GLuint program) |
Uses the GL program in case program is different than the current one. More... | |
void CC_DLL | ccGLDeleteProgram (GLuint program) |
Deletes the GL program. More... | |
void CC_DLL | ccGLBlendFunc (GLenum sfactor, GLenum dfactor) |
Uses a blending function in case it not already used. More... | |
void CC_DLL | ccGLBlendResetToCache (void) |
Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation(). More... | |
void CC_DLL | ccSetProjectionMatrixDirty (void) |
sets the projection matrix as dirty More... | |
void CC_DLL | ccGLEnableVertexAttribs (unsigned int flags) |
Will enable the vertex attribs that are passed as flags. More... | |
void CC_DLL | ccGLBindTexture2D (GLuint textureId) |
If the texture is not already bound to texture unit 0, it binds it. More... | |
void CC_DLL | ccGLBindTexture2DN (GLuint textureUnit, GLuint textureId) |
If the texture is not already bound to a given unit, it binds it. More... | |
void CC_DLL | ccGLDeleteTexture (GLuint textureId) |
It will delete a given texture. More... | |
void CC_DLL | ccGLDeleteTextureN (GLuint textureUnit, GLuint textureId) |
It will delete a given texture. More... | |
void CC_DLL | ccGLBindVAO (GLuint vaoId) |
If the vertex array is not already bound, it binds it. More... | |
void CC_DLL | ccGLEnable (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 |
enum ccGLServerState |
void CC_DLL ccGLBindTexture2D | ( | GLuint | textureId | ) |
If the texture is not already bound to texture unit 0, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
void CC_DLL 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 ccGLBindVAO | ( | GLuint | vaoId | ) |
If the vertex array is not already bound, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
void CC_DLL 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 ccGLBlendResetToCache | ( | void | ) |
Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().
If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
void CC_DLL ccGLDeleteProgram | ( | GLuint | program | ) |
Deletes the GL program.
If it is the one that is being used, it invalidates it. If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
void CC_DLL ccGLDeleteTexture | ( | GLuint | textureId | ) |
It will delete a given texture.
If the texture was bound, it will invalidate the cached. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
void CC_DLL ccGLDeleteTextureN | ( | GLuint | textureUnit, |
GLuint | textureId | ||
) |
It will delete a given texture.
If the texture was bound, it will invalidate the cached for the given texture unit. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
void CC_DLL 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.
void CC_DLL 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 ccGLInvalidateStateCache | ( | void | ) |
Invalidates the GL state cache.
If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
void CC_DLL 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 ccSetProjectionMatrixDirty | ( | void | ) |
sets the projection matrix as dirty