cocos2d-x  3.0alpha1
 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...
 
var  ( var flags)
 Will enable the vertex attribs that are passed as flags. More...
 
local  ( local 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...
 

Variables

CC_DLL const GLcharccPosition_uColor_frag
var ccPosition_uColor_frag
local ccPosition_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
CC_DLL const GLcharccPositionTextureA8Color_frag
var ccPositionTextureA8Color_frag
local ccPositionTextureA8Color_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 GLcharccPositionTextureColorAlphaTest_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
var ccPositionColorLengthTexture_vert
local ccPositionColorLengthTexture_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

Variable Documentation

CC_DLL const GLchar*
ccExSwitchMask_frag
var ccExSwitchMask_frag
local ccExSwitchMask_frag
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_vert
var ccPositionTextureColor_vert
local ccPositionTextureColor_vert
CC_DLL const GLchar*
ccPositionTextureColorAlphaTest_frag
var
ccPositionTextureColorAlphaTest_frag
local
ccPositionTextureColorAlphaTest_frag