cocos2d-x  3.0-beta2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Shaders

Files

file  ccGLStateCache.h
 

Namespaces

 cocos2d::GL
 

Classes

class  GLProgram
 GLProgram Class that implements a glProgram. More...
 
class  ShaderCache
 ShaderCache Singleton that stores manages GL shaders. More...
 

Typedefs

typedef void(* GLInfoFunction )(GLuint program, GLenum pname, GLint *params)
typedef void(* GLLogFunction )(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)

Enumerations

enum  {
  VERTEX_ATTRIB_FLAT_NONE = 0, VERTEX_ATTRIB_FLAG_POSITION = 1 << 0, VERTEX_ATTRIB_FLAG_COLOR = 1 << 1, VERTEX_ATTRIB_FLAG_TEX_COORDS = 1 << 2,
  VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = (VERTEX_ATTRIB_FLAG_POSITION | VERTEX_ATTRIB_FLAG_COLOR | VERTEX_ATTRIB_FLAG_TEX_COORDS)
}
 vertex attrib flags More...
 

Functions

void CC_DLL  (void)
 Invalidates the GL state cache. More...
 
var  ()
 Invalidates the GL state cache. More...
 
local  ()
 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  (GLenum texture)
 Select active texture unit. More...
 

Variables

CC_DLL const GLcharccPosition_uColor_frag
CC_DLL const GLcharccPosition_uColor_vert
var ccPosition_uColor_vert
local ccPosition_uColor_vert
CC_DLL const GLcharccPositionColor_frag
var ccPositionColor_frag
local ccPositionColor_frag
CC_DLL const GLcharccPositionColor_vert
var ccPositionColor_vert
local ccPositionColor_vert
CC_DLL const GLcharccPositionTexture_frag
var ccPositionTexture_frag
local ccPositionTexture_frag
CC_DLL const GLcharccPositionTexture_vert
var ccPositionTexture_vert
local ccPositionTexture_vert
CC_DLL const GLcharccPositionTextureA8Color_frag
CC_DLL const GLcharccPositionTextureA8Color_vert
var ccPositionTextureA8Color_vert
local ccPositionTextureA8Color_vert
CC_DLL const GLcharccPositionTextureColor_frag
var ccPositionTextureColor_frag
local ccPositionTextureColor_frag
CC_DLL const GLcharccPositionTextureColor_vert
var ccPositionTextureColor_vert
local ccPositionTextureColor_vert
CC_DLL const GLcharccPositionTextureColor_noMVP_frag
CC_DLL const GLcharccPositionTextureColor_noMVP_vert
var ccPositionTextureColor_noMVP_vert
local ccPositionTextureColor_noMVP_vert
CC_DLL const GLcharccPositionTextureColorAlphaTest_frag
var ccPositionTextureColorAlphaTest_frag
local ccPositionTextureColorAlphaTest_frag
CC_DLL const GLcharccPositionTexture_uColor_frag
var ccPositionTexture_uColor_frag
local ccPositionTexture_uColor_frag
CC_DLL const GLcharccPositionTexture_uColor_vert
var ccPositionTexture_uColor_vert
local ccPositionTexture_uColor_vert
CC_DLL const GLcharccPositionColorLengthTexture_frag
CC_DLL const GLcharccPositionColorLengthTexture_vert
CC_DLL const GLcharccLabelDistanceFieldNormal_frag
CC_DLL const GLcharccLabelDistanceFieldNormal_vert
var ccLabelDistanceFieldNormal_vert
local ccLabelDistanceFieldNormal_vert
CC_DLL const GLcharccLabelDistanceFieldGlow_frag
var ccLabelDistanceFieldGlow_frag
local ccLabelDistanceFieldGlow_frag
CC_DLL const GLcharccLabelDistanceFieldGlow_vert
var ccLabelDistanceFieldGlow_vert
local ccLabelDistanceFieldGlow_vert
CC_DLL const GLcharccLabelDistanceFieldOutline_frag
CC_DLL const GLcharccLabelDistanceFieldOutline_vert
var ccLabelDistanceFieldOutline_vert
local ccLabelDistanceFieldOutline_vert
CC_DLL const GLcharccLabelDistanceFieldShadow_frag
var ccLabelDistanceFieldShadow_frag
local ccLabelDistanceFieldShadow_frag
CC_DLL const GLcharccLabelDistanceFieldShadow_vert
var ccLabelDistanceFieldShadow_vert
local ccLabelDistanceFieldShadow_vert
CC_DLL const GLcharccExSwitchMask_frag
var ccExSwitchMask_frag
local ccExSwitchMask_frag

Detailed Description

Typedef Documentation

typedef void(* GLInfoFunction)(GLuint
program, GLenum pname, GLint
*params)
typedef void(* GLInfoFunction)(GLuint
program, GLenum pname, GLint
*params)
typedef void(* GLInfoFunction)(GLuint
program, GLenum pname, GLint
*params)
typedef void(* GLLogFunction)(GLuint
program, GLsizei bufsize,
GLsizei *length, GLchar
*infolog)
typedef void(* GLLogFunction)(GLuint
program, GLsizei bufsize,
GLsizei *length, GLchar
*infolog)
typedef void(* GLLogFunction)(GLuint
program, GLsizei bufsize,
GLsizei *length, GLchar
*infolog)

Enumeration Type Documentation

anonymous enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAT_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORDS 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 
var enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAT_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORDS 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 
local enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAT_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORDS 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 

Function Documentation

void CC_DLL
cocos2d::GL::invalidateStateCache
( void  )

Invalidates the GL state cache.

If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.

Since
v2.0.0
var invalidateStateCache (   )

Invalidates the GL state cache.

If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.

Since
v2.0.0
local invalidateStateCache (   )

Invalidates the GL state cache.

If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.

Since
v2.0.0
void CC_DLL cocos2d::GL::useProgram ( 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.

Since
v2.0.0
var useProgram ( var  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.

Since
v2.0.0
local useProgram ( local  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.

Since
v2.0.0
void CC_DLL cocos2d::GL::blendFunc ( 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.

Since
v2.0.0
var blendFunc ( var  sfactor,
var  dfactor 
)

Uses a blending function in case it not already used.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.

Since
v2.0.0
local blendFunc ( local  sfactor,
local  dfactor 
)

Uses a blending function in case it not already used.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.

Since
v2.0.0
void CC_DLL
cocos2d::GL::enableVertexAttribs
( unsigned int  flags)

Will enable the vertex attribs that are passed as flags.

Possible flags:

 VERTEX_ATTRIB_FLAG_POSITION
 VERTEX_ATTRIB_FLAG_COLOR
 VERTEX_ATTRIB_FLAG_TEX_COORDS

These flags can be ORed. The flags that are not present, will be disabled.

Since
v2.0.0
var enableVertexAttribs ( var  flags)

Will enable the vertex attribs that are passed as flags.

Possible flags:

 VERTEX_ATTRIB_FLAG_POSITION
 VERTEX_ATTRIB_FLAG_COLOR
 VERTEX_ATTRIB_FLAG_TEX_COORDS

These flags can be ORed. The flags that are not present, will be disabled.

Since
v2.0.0
local enableVertexAttribs ( local  flags)

Will enable the vertex attribs that are passed as flags.

Possible flags:

 VERTEX_ATTRIB_FLAG_POSITION
 VERTEX_ATTRIB_FLAG_COLOR
 VERTEX_ATTRIB_FLAG_TEX_COORDS

These flags can be ORed. The flags that are not present, will be disabled.

Since
v2.0.0
void CC_DLL
cocos2d::GL::bindTexture2DN
( 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.

Since
v2.1.0
var bindTexture2DN ( var  textureUnit,
var  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.

Since
v2.1.0
local bindTexture2DN ( local  textureUnit,
local  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.

Since
v2.1.0
void CC_DLL
cocos2d::GL::activeTexture
( GLenum  texture)

Select active texture unit.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.

Since
v3.0
var activeTexture ( var  texture)

Select active texture unit.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.

Since
v3.0
local activeTexture ( local  texture)

Select active texture unit.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.

Since
v3.0

Variable Documentation

CC_DLL const GLchar*
ccExSwitchMask_frag
var ccExSwitchMask_frag
local ccExSwitchMask_frag
CC_DLL const GLchar*
ccLabelDistanceFieldGlow_frag
var ccLabelDistanceFieldGlow_frag
local ccLabelDistanceFieldGlow_frag
CC_DLL const GLchar*
ccLabelDistanceFieldGlow_vert
var ccLabelDistanceFieldGlow_vert
local ccLabelDistanceFieldGlow_vert
CC_DLL const GLchar*
ccLabelDistanceFieldNormal_frag
var ccLabelDistanceFieldNormal_frag
local
ccLabelDistanceFieldNormal_frag
CC_DLL const GLchar*
ccLabelDistanceFieldNormal_vert
var ccLabelDistanceFieldNormal_vert
local
ccLabelDistanceFieldNormal_vert
CC_DLL const GLchar*
ccLabelDistanceFieldOutline_frag
var
ccLabelDistanceFieldOutline_frag
local
ccLabelDistanceFieldOutline_frag
CC_DLL const GLchar*
ccLabelDistanceFieldOutline_vert
var
ccLabelDistanceFieldOutline_vert
local
ccLabelDistanceFieldOutline_vert
CC_DLL const GLchar*
ccLabelDistanceFieldShadow_frag
var ccLabelDistanceFieldShadow_frag
local
ccLabelDistanceFieldShadow_frag
CC_DLL const GLchar*
ccLabelDistanceFieldShadow_vert
var ccLabelDistanceFieldShadow_vert
local
ccLabelDistanceFieldShadow_vert
CC_DLL const GLchar*
ccPosition_uColor_frag
var ccPosition_uColor_frag
local ccPosition_uColor_frag
CC_DLL const GLchar*
ccPosition_uColor_vert
var ccPosition_uColor_vert
local ccPosition_uColor_vert
CC_DLL const GLchar*
ccPositionColor_frag
var ccPositionColor_frag
local ccPositionColor_frag
CC_DLL const GLchar*
ccPositionColor_vert
var ccPositionColor_vert
local ccPositionColor_vert
CC_DLL const GLchar*
ccPositionColorLengthTexture_frag
var
ccPositionColorLengthTexture_frag
local
ccPositionColorLengthTexture_frag
CC_DLL const GLchar*
ccPositionColorLengthTexture_vert
var
ccPositionColorLengthTexture_vert
local
ccPositionColorLengthTexture_vert
CC_DLL const GLchar*
ccPositionTexture_frag
var ccPositionTexture_frag
local ccPositionTexture_frag
CC_DLL const GLchar*
ccPositionTexture_uColor_frag
var ccPositionTexture_uColor_frag
local ccPositionTexture_uColor_frag
CC_DLL const GLchar*
ccPositionTexture_uColor_vert
var ccPositionTexture_uColor_vert
local ccPositionTexture_uColor_vert
CC_DLL const GLchar*
ccPositionTexture_vert
var ccPositionTexture_vert
local ccPositionTexture_vert
CC_DLL const GLchar*
ccPositionTextureA8Color_frag
var ccPositionTextureA8Color_frag
local ccPositionTextureA8Color_frag
CC_DLL const GLchar*
ccPositionTextureA8Color_vert
var ccPositionTextureA8Color_vert
local ccPositionTextureA8Color_vert
CC_DLL const GLchar*
ccPositionTextureColor_frag
var ccPositionTextureColor_frag
local ccPositionTextureColor_frag
CC_DLL const GLchar*
ccPositionTextureColor_noMVP_frag
var
ccPositionTextureColor_noMVP_frag
local
ccPositionTextureColor_noMVP_frag
CC_DLL const GLchar*
ccPositionTextureColor_noMVP_vert
var
ccPositionTextureColor_noMVP_vert
local
ccPositionTextureColor_noMVP_vert
CC_DLL const GLchar*
ccPositionTextureColor_vert
var ccPositionTextureColor_vert
local ccPositionTextureColor_vert
CC_DLL const GLchar*
ccPositionTextureColorAlphaTest_frag
var
ccPositionTextureColorAlphaTest_frag
local
ccPositionTextureColorAlphaTest_frag