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

Files

file  ccGLStateCache.h
 

Namespaces

 cocos2d::GL
 

Classes

struct  VertexAttrib
 
struct  Uniform
 
class  GLProgram
 GLProgram Class that implements a glProgram. More...
 
struct  GLProgram::flag_struct
 
class  GLProgramCache
 GLProgramCache Singleton that stores manages GLProgram objects (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_POSITION, VERTEX_ATTRIB_COLOR, VERTEX_ATTRIB_TEX_COORD, VERTEX_ATTRIB_TEX_COORD1,
  VERTEX_ATTRIB_TEX_COORD2, VERTEX_ATTRIB_TEX_COORD3, VERTEX_ATTRIB_NORMAL, VERTEX_ATTRIB_BLEND_WEIGHT,
  VERTEX_ATTRIB_BLEND_INDEX, VERTEX_ATTRIB_MAX, VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD
}
 
enum  {
  UNIFORM_AMBIENT_COLOR, UNIFORM_P_MATRIX, UNIFORM_MV_MATRIX, UNIFORM_MVP_MATRIX,
  UNIFORM_NORMAL_MATRIX, UNIFORM_TIME, UNIFORM_SIN_TIME, UNIFORM_COS_TIME,
  UNIFORM_RANDOM01, UNIFORM_SAMPLER0, UNIFORM_SAMPLER1, UNIFORM_SAMPLER2,
  UNIFORM_SAMPLER3, UNIFORM_MAX
}
 
enum  {
  VERTEX_ATTRIB_FLAG_NONE = 0, VERTEX_ATTRIB_FLAG_POSITION = 1 << 0, VERTEX_ATTRIB_FLAG_COLOR = 1 << 1, VERTEX_ATTRIB_FLAG_TEX_COORD = 1 << 2,
  VERTEX_ATTRIB_FLAG_NORMAL = 1 << 3, VERTEX_ATTRIB_FLAG_BLEND_WEIGHT = 1 << 4, VERTEX_ATTRIB_FLAG_BLEND_INDEX = 1 << 5, VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = (VERTEX_ATTRIB_FLAG_POSITION | VERTEX_ATTRIB_FLAG_COLOR | VERTEX_ATTRIB_FLAG_TEX_COORD)
}
 vertex attrib flags More...
 

Functions

 GLProgram ()
 GLProgram ()
 GLProgram ()
virtual ~GLProgram ()
local ~GLProgram ()
static GLProgram * createWithPrecompiledProgramByteArray (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
 Initializes the GLProgram with a vertex and fragment with bytes array. More...
 
local initWithString ( local vShaderByteArray, local fShaderByteArray)
 Initializes the GLProgram with a vertex and fragment with bytes array. More...
 
bool initWithPrecompiledProgramByteArray (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
static GLProgram * createWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
 Initializes the GLProgram with a vertex and fragment with bytes array. More...
 
var initWithString ( var vShaderByteArray, var fShaderByteArray)
 Initializes the GLProgram with a vertex and fragment with bytes array. More...
 
local initWithString ( local vShaderByteArray, local fShaderByteArray)
 Initializes the GLProgram with a vertex and fragment with bytes array. More...
 
bool initWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
static GLProgram * createWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
 Initializes the GLProgram with a vertex and fragment with contents of filenames. More...
 
bool initWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
Uniform * getUniform (const std::string &name)
VertexAttrib * getVertexAttrib (const std::string &name)
var getVertexAttrib ( var name)
local getVertexAttrib ( local name)
void bindAttribLocation (const std::string &attributeName, GLuint index) const
 It will add a new attribute to the shader by calling glBindAttribLocation. More...
 
var bindAttribLocation ( var attributeName, var index)
 It will add a new attribute to the shader by calling glBindAttribLocation. More...
 
local bindAttribLocation ( local attributeName, local index)
 It will add a new attribute to the shader by calling glBindAttribLocation. More...
 
GLint getAttribLocation (const std::string &attributeName) const
 calls glGetAttribLocation More...
 
GLint getUniformLocation (const std::string &attributeName) const
 calls glGetUniformLocation() More...
 
bool link ()
 links the glProgram More...
 
var link ()
 links the glProgram More...
 
local link ()
 links the glProgram More...
 
void use ()
 it will call glUseProgram() More...
 
void updateUniforms ()
 It will create 4 uniforms: More...
 
var updateUniforms ()
 It will create 4 uniforms: More...
 
local updateUniforms ()
 It will create 4 uniforms: More...
 
GLint getUniformLocationForName (const char *name) const
 calls retrieves the named uniform location for this shader program. More...
 
local getUniformLocationForName ( local name)
 calls retrieves the named uniform location for this shader program. More...
 
void setUniformLocationWith1i (GLint location, GLint i1)
 calls glUniform1i only if the values are different than the previous call for this same shader program. More...
 
var setUniformLocationI32 ( var location, var i1)
 calls glUniform1i only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationI32 ( local location, local i1)
 calls glUniform1i only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith2i (GLint location, GLint i1, GLint i2)
 calls glUniform2i only if the values are different than the previous call for this same shader program. More...
 
var setUniformLocationWith2i ( var location, var i1, var i2)
 calls glUniform2i only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith2i ( local location, local i1, local i2)
 calls glUniform2i only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith3i (GLint location, GLint i1, GLint i2, GLint i3)
 calls glUniform3i only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith4i (GLint location, GLint i1, GLint i2, GLint i3, GLint i4)
 calls glUniform4i only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith2iv (GLint location, GLint *ints, unsigned int numberOfArrays)
 calls glUniform2iv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith3iv (GLint location, GLint *ints, unsigned int numberOfArrays)
 calls glUniform3iv only if the values are different than the previous call for this same shader program. More...
 
var setUniformLocationWith3iv ( var location, var ints, var numberOfArrays)
 calls glUniform3iv only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith3iv ( local location, local ints, local numberOfArrays)
 calls glUniform3iv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith4iv (GLint location, GLint *ints, unsigned int numberOfArrays)
 calls glUniform4iv only if the values are different than the previous call for this same shader program. More...
 
var setUniformLocationWith4iv ( var location, var ints, var numberOfArrays)
 calls glUniform4iv only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith4iv ( local location, local ints, local numberOfArrays)
 calls glUniform4iv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith1f (GLint location, GLfloat f1)
 calls glUniform1f only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith1f ( local location, local f1)
 calls glUniform1f only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith2f (GLint location, GLfloat f1, GLfloat f2)
 calls glUniform2f only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith2f ( local location, local f1, local f2)
 calls glUniform2f only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith3f (GLint location, GLfloat f1, GLfloat f2, GLfloat f3)
 calls glUniform3f only if the values are different than the previous call for this same shader program. More...
 
local setUniformLocationWith3f ( local location, local f1, local f2, local f3)
 calls glUniform3f only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith4f (GLint location, GLfloat f1, GLfloat f2, GLfloat f3, GLfloat f4)
 calls glUniform4f only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith1fv (GLint location, const GLfloat *floats, unsigned int numberOfArrays)
 calls glUniformfv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith2fv (GLint location, const GLfloat *floats, unsigned int numberOfArrays)
 calls glUniform2fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith3fv (GLint location, const GLfloat *floats, unsigned int numberOfArrays)
 calls glUniform3fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWith4fv (GLint location, const GLfloat *floats, unsigned int numberOfArrays)
 calls glUniform4fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWithMatrix2fv (GLint location, const GLfloat *matrixArray, unsigned int numberOfMatrices)
 calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWithMatrix3fv (GLint location, const GLfloat *matrixArray, unsigned int numberOfMatrices)
 calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformLocationWithMatrix4fv (GLint location, const GLfloat *matrixArray, unsigned int numberOfMatrices)
 calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. More...
 
void setUniformsForBuiltins ()
 will update the builtin uniforms if they are different than the previous call for this same shader program. More...
 
void setUniformsForBuiltins (const Mat4 &modelView)
var setUniformsForBuiltins ( var modelView)
local setUniformsForBuiltins ( local modelView)
std::string getVertexShaderLog () const
 returns the vertexShader error log More...
 
var getVertexShaderLog ()
 returns the vertexShader error log More...
 
local getVertexShaderLog ()
 returns the vertexShader error log More...
 
std::string getFragmentShaderLog () const
 returns the fragmentShader error log More...
 
var getFragmentShaderLog ()
 returns the fragmentShader error log More...
 
local getFragmentShaderLog ()
 returns the fragmentShader error log More...
 
std::string getProgramLog () const
 returns the program error log More...
 
var getProgramLog ()
 returns the program error log More...
 
local getProgramLog ()
 returns the program error log More...
 
void reset ()
const GLuint getProgram () const
var getProgram ()
local getProgram ()
bool initWithVertexShaderByteArray (const GLchar *vertexByteArray, const GLchar *fragByteArray)
var initWithVertexShaderByteArray ( var vertexByteArray, var fragByteArray)
local initWithVertexShaderByteArray ( local vertexByteArray, local fragByteArray)
bool initWithVertexShaderFilename (const std::string &vertexFilename, const std::string &fragFilename)
void addAttribute (const std::string &attributeName, GLuint index) const
bool updateUniformLocation (GLint location, const GLvoid *data, unsigned int bytes)
var updateUniformLocation ( var location, var data, var bytes)
local updateUniformLocation ( local location, local data, local bytes)
virtual std::string getDescription () const
var getDescription ()
local getDescription ()
void bindPredefinedVertexAttribs ()
var bindPredefinedVertexAttribs ()
local bindPredefinedVertexAttribs ()
void parseVertexAttribs ()
var parseVertexAttribs ()
local parseVertexAttribs ()
void parseUniforms ()
var parseUniforms ()
local parseUniforms ()
bool compileShader (GLuint *shader, GLenum type, const GLchar *source)
var compileShader ( var shader, var type, var source)
local compileShader ( local shader, local type, local source)
 flag_struct ()
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  (uint32_t 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...
 
var  ( var textureUnit, var textureId)
 If the texture is not already bound to a given unit, it binds it. More...
 
local  ( local textureUnit, local 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

GLuint index
var index
local index
GLint size
var size
local size
GLenum type
var type
local type
std::string name
var name
local name
GLint location
var location
local location
GLint size
var size
local size
GLenum type
var type
local type
std::string name
var name
local name
static const char * SHADER_NAME_POSITION_TEXTURE_COLOR
static const char * SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static const char * SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
var SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
local SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static const char * SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static const char * SHADER_NAME_POSITION_COLOR
var SHADER_NAME_POSITION_COLOR
local SHADER_NAME_POSITION_COLOR
static const char * SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static const char * SHADER_NAME_POSITION_COLOR_NO_MVP
var SHADER_NAME_POSITION_COLOR_NO_MVP
local SHADER_NAME_POSITION_COLOR_NO_MVP
static const char * SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE
static const char * SHADER_NAME_POSITION_TEXTURE
var SHADER_NAME_POSITION_TEXTURE
local SHADER_NAME_POSITION_TEXTURE
static const char * SHADER_NAME_POSITION_TEXTURE_U_COLOR
var SHADER_NAME_POSITION_TEXTURE_U_COLOR
local SHADER_NAME_POSITION_TEXTURE_U_COLOR
static const char * SHADER_NAME_POSITION_TEXTURE_A8_COLOR
var SHADER_NAME_POSITION_TEXTURE_A8_COLOR
local SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static const char * SHADER_NAME_POSITION_U_COLOR
var SHADER_NAME_POSITION_U_COLOR
local SHADER_NAME_POSITION_U_COLOR
static const char * SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
static const char * SHADER_NAME_LABEL_NORMAL
var SHADER_NAME_LABEL_NORMAL
local SHADER_NAME_LABEL_NORMAL
static const char * SHADER_NAME_LABEL_OUTLINE
var SHADER_NAME_LABEL_OUTLINE
local SHADER_NAME_LABEL_OUTLINE
static const char * SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
static const char * SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
var SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
local SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
static const char * SHADER_3D_POSITION
var SHADER_3D_POSITION
local SHADER_3D_POSITION
static const char * SHADER_3D_POSITION_TEXTURE
var SHADER_3D_POSITION_TEXTURE
local SHADER_3D_POSITION_TEXTURE
static const char * SHADER_3D_SKINPOSITION_TEXTURE
var SHADER_3D_SKINPOSITION_TEXTURE
local SHADER_3D_SKINPOSITION_TEXTURE
static const char * SHADER_3D_POSITION_NORMAL
var SHADER_3D_POSITION_NORMAL
local SHADER_3D_POSITION_NORMAL
static const char * SHADER_3D_POSITION_NORMAL_TEXTURE
static const char * SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static const char * UNIFORM_NAME_AMBIENT_COLOR
var UNIFORM_NAME_AMBIENT_COLOR
local UNIFORM_NAME_AMBIENT_COLOR
static const char * UNIFORM_NAME_P_MATRIX
var UNIFORM_NAME_P_MATRIX
local UNIFORM_NAME_P_MATRIX
static const char * UNIFORM_NAME_MV_MATRIX
var UNIFORM_NAME_MV_MATRIX
local UNIFORM_NAME_MV_MATRIX
static const char * UNIFORM_NAME_MVP_MATRIX
var UNIFORM_NAME_MVP_MATRIX
local UNIFORM_NAME_MVP_MATRIX
static const char * UNIFORM_NAME_NORMAL_MATRIX
var UNIFORM_NAME_NORMAL_MATRIX
local UNIFORM_NAME_NORMAL_MATRIX
static const char * UNIFORM_NAME_TIME
var UNIFORM_NAME_TIME
local UNIFORM_NAME_TIME
static const char * UNIFORM_NAME_SIN_TIME
var UNIFORM_NAME_SIN_TIME
local UNIFORM_NAME_SIN_TIME
static const char * UNIFORM_NAME_COS_TIME
var UNIFORM_NAME_COS_TIME
local UNIFORM_NAME_COS_TIME
static const char * UNIFORM_NAME_RANDOM01
var UNIFORM_NAME_RANDOM01
local UNIFORM_NAME_RANDOM01
static const char * UNIFORM_NAME_SAMPLER0
var UNIFORM_NAME_SAMPLER0
local UNIFORM_NAME_SAMPLER0
static const char * UNIFORM_NAME_SAMPLER1
var UNIFORM_NAME_SAMPLER1
local UNIFORM_NAME_SAMPLER1
static const char * UNIFORM_NAME_SAMPLER2
var UNIFORM_NAME_SAMPLER2
local UNIFORM_NAME_SAMPLER2
static const char * UNIFORM_NAME_SAMPLER3
var UNIFORM_NAME_SAMPLER3
local UNIFORM_NAME_SAMPLER3
static const char * UNIFORM_NAME_ALPHA_TEST_VALUE
var UNIFORM_NAME_ALPHA_TEST_VALUE
local UNIFORM_NAME_ALPHA_TEST_VALUE
static const char * ATTRIBUTE_NAME_COLOR
var ATTRIBUTE_NAME_COLOR
local ATTRIBUTE_NAME_COLOR
static const char * ATTRIBUTE_NAME_POSITION
var ATTRIBUTE_NAME_POSITION
local ATTRIBUTE_NAME_POSITION
static const char * ATTRIBUTE_NAME_TEX_COORD
var ATTRIBUTE_NAME_TEX_COORD
local ATTRIBUTE_NAME_TEX_COORD
static const char * ATTRIBUTE_NAME_TEX_COORD1
var ATTRIBUTE_NAME_TEX_COORD1
local ATTRIBUTE_NAME_TEX_COORD1
static const char * ATTRIBUTE_NAME_TEX_COORD2
var ATTRIBUTE_NAME_TEX_COORD2
local ATTRIBUTE_NAME_TEX_COORD2
static const char * ATTRIBUTE_NAME_TEX_COORD3
var ATTRIBUTE_NAME_TEX_COORD3
local ATTRIBUTE_NAME_TEX_COORD3
static const char * ATTRIBUTE_NAME_NORMAL
var ATTRIBUTE_NAME_NORMAL
local ATTRIBUTE_NAME_NORMAL
static const char * ATTRIBUTE_NAME_BLEND_WEIGHT
var ATTRIBUTE_NAME_BLEND_WEIGHT
local ATTRIBUTE_NAME_BLEND_WEIGHT
static const char * ATTRIBUTE_NAME_BLEND_INDEX
var ATTRIBUTE_NAME_BLEND_INDEX
local ATTRIBUTE_NAME_BLEND_INDEX
GLuint _program
GLuint _vertShader
GLuint _fragShader
var _fragShader
local _fragShader
GLint _builtInUniforms [UNIFORM_MAX]
var _builtInUniforms ()
local _builtInUniforms ()
bool _hasShaderCompiler
local _hasShaderCompiler
std::string _shaderId
var _shaderId
local _shaderId
unsigned int usesTime:1
var usesTime:1
local usesTime:1
unsigned int usesNormal:1
var usesNormal:1
local usesNormal:1
unsigned int usesMVP:1
var usesMVP:1
local usesMVP:1
unsigned int usesMV:1
var usesMV:1
local usesMV:1
unsigned int usesP:1
var usesP:1
local usesP:1
unsigned int usesRandom:1
var usesRandom:1
local usesRandom:1
struct
cocos2d::GLProgram::flag_struct 
_flags
var _flags
local _flags
std::unordered_map
< std::string, Uniform > 
_userUniforms
var _userUniforms
local _userUniforms
std::unordered_map
< std::string, VertexAttrib > 
_vertexAttribs
std::unordered_map< GLint,
std::pair< GLvoid *, unsigned
int > > 
_hashForUniforms
Director * _director
local _director
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 GLcharccPositionColorTextureAsPointsize_vert
var ccPositionColorTextureAsPointsize_vert
local ccPositionColorTextureAsPointsize_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
var ccPositionTextureA8Color_frag
local ccPositionTextureA8Color_frag
CC_DLL const GLcharccPositionTextureA8Color_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
var ccPositionTextureColor_noMVP_frag
local ccPositionTextureColor_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
var ccPositionColorLengthTexture_frag
local ccPositionColorLengthTexture_frag
CC_DLL const GLcharccPositionColorLengthTexture_vert
var ccPositionColorLengthTexture_vert
local ccPositionColorLengthTexture_vert
CC_DLL const GLcharccLabelDistanceFieldNormal_frag
var ccLabelDistanceFieldNormal_frag
local ccLabelDistanceFieldNormal_frag
CC_DLL const GLcharccLabelDistanceFieldGlow_frag
var ccLabelDistanceFieldGlow_frag
local ccLabelDistanceFieldGlow_frag
CC_DLL const GLcharccLabelNormal_frag
var ccLabelNormal_frag
local ccLabelNormal_frag
CC_DLL const GLcharccLabelOutline_frag
var ccLabelOutline_frag
local ccLabelOutline_frag
CC_DLL const GLcharccLabel_vert
var ccLabel_vert
local ccLabel_vert
CC_DLL const GLcharcc3D_PositionTex_vert
var cc3D_PositionTex_vert
local cc3D_PositionTex_vert
CC_DLL const GLcharcc3D_SkinPositionTex_vert
var cc3D_SkinPositionTex_vert
local cc3D_SkinPositionTex_vert
CC_DLL const GLcharcc3D_ColorTex_frag
var cc3D_ColorTex_frag
local cc3D_ColorTex_frag
CC_DLL const GLcharcc3D_Color_frag
var cc3D_Color_frag
local cc3D_Color_frag
CC_DLL const GLcharcc3D_PositionNormalTex_vert
var cc3D_PositionNormalTex_vert
local cc3D_PositionNormalTex_vert
CC_DLL const GLcharcc3D_SkinPositionNormalTex_vert
var cc3D_SkinPositionNormalTex_vert
local cc3D_SkinPositionNormalTex_vert
CC_DLL const GLcharcc3D_ColorNormalTex_frag
var cc3D_ColorNormalTex_frag
local cc3D_ColorNormalTex_frag
CC_DLL const GLcharcc3D_ColorNormal_frag
var cc3D_ColorNormal_frag
local cc3D_ColorNormal_frag

Friends

class GLProgramState

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
Enumerator
VERTEX_ATTRIB_POSITION 
VERTEX_ATTRIB_COLOR 
VERTEX_ATTRIB_TEX_COORD 
VERTEX_ATTRIB_TEX_COORD1 
VERTEX_ATTRIB_TEX_COORD2 
VERTEX_ATTRIB_TEX_COORD3 
VERTEX_ATTRIB_NORMAL 
VERTEX_ATTRIB_BLEND_WEIGHT 
VERTEX_ATTRIB_BLEND_INDEX 
VERTEX_ATTRIB_MAX 
VERTEX_ATTRIB_TEX_COORDS 
var enum
Enumerator
VERTEX_ATTRIB_POSITION 
VERTEX_ATTRIB_COLOR 
VERTEX_ATTRIB_TEX_COORD 
VERTEX_ATTRIB_TEX_COORD1 
VERTEX_ATTRIB_TEX_COORD2 
VERTEX_ATTRIB_TEX_COORD3 
VERTEX_ATTRIB_NORMAL 
VERTEX_ATTRIB_BLEND_WEIGHT 
VERTEX_ATTRIB_BLEND_INDEX 
VERTEX_ATTRIB_MAX 
VERTEX_ATTRIB_TEX_COORDS 
local enum
Enumerator
VERTEX_ATTRIB_POSITION 
VERTEX_ATTRIB_COLOR 
VERTEX_ATTRIB_TEX_COORD 
VERTEX_ATTRIB_TEX_COORD1 
VERTEX_ATTRIB_TEX_COORD2 
VERTEX_ATTRIB_TEX_COORD3 
VERTEX_ATTRIB_NORMAL 
VERTEX_ATTRIB_BLEND_WEIGHT 
VERTEX_ATTRIB_BLEND_INDEX 
VERTEX_ATTRIB_MAX 
VERTEX_ATTRIB_TEX_COORDS 
anonymous enum
Enumerator
UNIFORM_AMBIENT_COLOR 
UNIFORM_P_MATRIX 
UNIFORM_MV_MATRIX 
UNIFORM_MVP_MATRIX 
UNIFORM_NORMAL_MATRIX 
UNIFORM_TIME 
UNIFORM_SIN_TIME 
UNIFORM_COS_TIME 
UNIFORM_RANDOM01 
UNIFORM_SAMPLER0 
UNIFORM_SAMPLER1 
UNIFORM_SAMPLER2 
UNIFORM_SAMPLER3 
UNIFORM_MAX 
anonymous enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAG_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORD 
VERTEX_ATTRIB_FLAG_NORMAL 
VERTEX_ATTRIB_FLAG_BLEND_WEIGHT 
VERTEX_ATTRIB_FLAG_BLEND_INDEX 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 
var enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAG_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORD 
VERTEX_ATTRIB_FLAG_NORMAL 
VERTEX_ATTRIB_FLAG_BLEND_WEIGHT 
VERTEX_ATTRIB_FLAG_BLEND_INDEX 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 
local enum

vertex attrib flags

Enumerator
VERTEX_ATTRIB_FLAG_NONE 
VERTEX_ATTRIB_FLAG_POSITION 
VERTEX_ATTRIB_FLAG_COLOR 
VERTEX_ATTRIB_FLAG_TEX_COORD 
VERTEX_ATTRIB_FLAG_NORMAL 
VERTEX_ATTRIB_FLAG_BLEND_WEIGHT 
VERTEX_ATTRIB_FLAG_BLEND_INDEX 
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX 

Function Documentation

flag_struct ( )
inline
var flag_struct ( )
inline
local flag_struct ( )
inline
GLProgram ( )
var GLProgram ( )
local GLProgram ( )
virtual ~GLProgram ( )
virtual
var ~GLProgram ( )
virtual
local ~GLProgram ( )
virtual
void addAttribute ( const std::string &  attributeName,
GLuint  index 
) const
inline
var addAttribute ( var  attributeName,
var  index 
)
inline
local addAttribute ( local  attributeName,
local  index 
)
inline
void bindAttribLocation ( const std::string &  attributeName,
GLuint  index 
) const

It will add a new attribute to the shader by calling glBindAttribLocation.

var bindAttribLocation ( var  attributeName,
var  index 
)

It will add a new attribute to the shader by calling glBindAttribLocation.

local bindAttribLocation ( local  attributeName,
local  index 
)

It will add a new attribute to the shader by calling glBindAttribLocation.

void bindPredefinedVertexAttribs ( )
protected
var bindPredefinedVertexAttribs ( )
protected
local bindPredefinedVertexAttribs ( )
protected
bool compileShader ( GLuint *  shader,
GLenum  type,
const GLchar source 
)
protected
var compileShader ( var  shader,
var  type,
var  source 
)
protected
local compileShader ( local  shader,
local  type,
local  source 
)
protected
static GLProgram*
createWithByteArrays
( const GLchar vShaderByteArray,
const GLchar fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

var initWithString ( var  vShaderByteArray,
var  fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

local initWithString ( local  vShaderByteArray,
local  fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

static GLProgram*
createWithFilenames
( const std::string &  vShaderFilename,
const std::string &  fShaderFilename 
)
static

Initializes the GLProgram with a vertex and fragment with contents of filenames.

var init ( var  vShaderFilename,
var  fShaderFilename 
)
static

Initializes the GLProgram with a vertex and fragment with contents of filenames.

local init ( local  vShaderFilename,
local  fShaderFilename 
)
static

Initializes the GLProgram with a vertex and fragment with contents of filenames.

static GLProgram*
createWithPrecompiledProgramByteArray
( const GLchar vShaderByteArray,
const GLchar fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

var initWithString ( var  vShaderByteArray,
var  fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

local initWithString ( local  vShaderByteArray,
local  fShaderByteArray 
)
static

Initializes the GLProgram with a vertex and fragment with bytes array.

GLint getAttribLocation ( const std::string &  attributeName) const

calls glGetAttribLocation

var getAttribLocation ( var  attributeName)

calls glGetAttribLocation

local getAttribLocation ( local  attributeName)

calls glGetAttribLocation

virtual std::string getDescription ( ) const
protectedvirtual
var getDescription ( )
protectedvirtual
local getDescription ( )
protectedvirtual
std::string getFragmentShaderLog ( ) const

returns the fragmentShader error log

var getFragmentShaderLog ( )

returns the fragmentShader error log

local getFragmentShaderLog ( )

returns the fragmentShader error log

const GLuint getProgram ( ) const
inline
var getProgram ( )
inline
local getProgram ( )
inline
std::string getProgramLog ( ) const

returns the program error log

var getProgramLog ( )

returns the program error log

local getProgramLog ( )

returns the program error log

Uniform* getUniform ( const std::string &  name)
var getUniform ( var  name)
local getUniform ( local  name)
GLint getUniformLocation ( const std::string &  attributeName) const

calls glGetUniformLocation()

var getUniformLocation ( var  attributeName)

calls glGetUniformLocation()

local getUniformLocation ( local  attributeName)

calls glGetUniformLocation()

GLint getUniformLocationForName ( const char *  name) const

calls retrieves the named uniform location for this shader program.

var getUniformLocationForName ( var  name)

calls retrieves the named uniform location for this shader program.

local getUniformLocationForName ( local  name)

calls retrieves the named uniform location for this shader program.

VertexAttrib* getVertexAttrib ( const std::string &  name)
var getVertexAttrib ( var  name)
local getVertexAttrib ( local  name)
std::string getVertexShaderLog ( ) const

returns the vertexShader error log

var getVertexShaderLog ( )

returns the vertexShader error log

local getVertexShaderLog ( )

returns the vertexShader error log

bool initWithByteArrays ( const GLchar vShaderByteArray,
const GLchar fShaderByteArray 
)
var initWithByteArrays ( var  vShaderByteArray,
var  fShaderByteArray 
)
local initWithByteArrays ( local  vShaderByteArray,
local  fShaderByteArray 
)
bool initWithFilenames ( const std::string &  vShaderFilename,
const std::string &  fShaderFilename 
)
var initWithFilenames ( var  vShaderFilename,
var  fShaderFilename 
)
local initWithFilenames ( local  vShaderFilename,
local  fShaderFilename 
)
bool
initWithPrecompiledProgramByteArray
( const GLchar vShaderByteArray,
const GLchar fShaderByteArray 
)
var
initWithPrecompiledProgramByteArray
( var  vShaderByteArray,
var  fShaderByteArray 
)
local
initWithPrecompiledProgramByteArray
( local  vShaderByteArray,
local  fShaderByteArray 
)
bool initWithVertexShaderByteArray ( const GLchar vertexByteArray,
const GLchar fragByteArray 
)
inline
var initWithVertexShaderByteArray ( var  vertexByteArray,
var  fragByteArray 
)
inline
local initWithVertexShaderByteArray ( local  vertexByteArray,
local  fragByteArray 
)
inline
bool initWithVertexShaderFilename ( const std::string &  vertexFilename,
const std::string &  fragFilename 
)
inline
var initWithVertexShaderFilename ( var  vertexFilename,
var  fragFilename 
)
inline
local initWithVertexShaderFilename ( local  vertexFilename,
local  fragFilename 
)
inline
bool link ( )

links the glProgram

var link ( )

links the glProgram

local link ( )

links the glProgram

void parseUniforms ( )
protected
var parseUniforms ( )
protected
local parseUniforms ( )
protected
void parseVertexAttribs ( )
protected
var parseVertexAttribs ( )
protected
local parseVertexAttribs ( )
protected
void reset ( )
var reset ( )
local reset ( )
void setUniformLocationWith1f ( GLint  location,
GLfloat  f1 
)

calls glUniform1f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

local setUniformLocationWith1f ( local  location,
local  f1 
)

calls glUniform1f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

void setUniformLocationWith1fv ( GLint  location,
const GLfloat *  floats,
unsigned int  numberOfArrays 
)

calls glUniformfv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith1fv ( var  location,
var  floats,
var  numberOfArrays 
)

calls glUniformfv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith1fv ( local  location,
local  floats,
local  numberOfArrays 
)

calls glUniformfv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith1i ( GLint  location,
GLint  i1 
)

calls glUniform1i only if the values are different than the previous call for this same shader program.

var setUniformLocationI32 ( var  location,
var  i1 
)

calls glUniform1i only if the values are different than the previous call for this same shader program.

local setUniformLocationI32 ( local  location,
local  i1 
)

calls glUniform1i only if the values are different than the previous call for this same shader program.

void setUniformLocationWith2f ( GLint  location,
GLfloat  f1,
GLfloat  f2 
)

calls glUniform2f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

local setUniformLocationWith2f ( local  location,
local  f1,
local  f2 
)

calls glUniform2f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

void setUniformLocationWith2fv ( GLint  location,
const GLfloat *  floats,
unsigned int  numberOfArrays 
)

calls glUniform2fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith2fv ( var  location,
var  floats,
var  numberOfArrays 
)

calls glUniform2fv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith2fv ( local  location,
local  floats,
local  numberOfArrays 
)

calls glUniform2fv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith2i ( GLint  location,
GLint  i1,
GLint  i2 
)

calls glUniform2i only if the values are different than the previous call for this same shader program.

var setUniformLocationWith2i ( var  location,
var  i1,
var  i2 
)

calls glUniform2i only if the values are different than the previous call for this same shader program.

local setUniformLocationWith2i ( local  location,
local  i1,
local  i2 
)

calls glUniform2i only if the values are different than the previous call for this same shader program.

void setUniformLocationWith2iv ( GLint  location,
GLint *  ints,
unsigned int  numberOfArrays 
)

calls glUniform2iv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith2iv ( var  location,
var  ints,
var  numberOfArrays 
)

calls glUniform2iv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith2iv ( local  location,
local  ints,
local  numberOfArrays 
)

calls glUniform2iv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith3f ( GLint  location,
GLfloat  f1,
GLfloat  f2,
GLfloat  f3 
)

calls glUniform3f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

local setUniformLocationWith3f ( local  location,
local  f1,
local  f2,
local  f3 
)

calls glUniform3f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

void setUniformLocationWith3fv ( GLint  location,
const GLfloat *  floats,
unsigned int  numberOfArrays 
)

calls glUniform3fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith3fv ( var  location,
var  floats,
var  numberOfArrays 
)

calls glUniform3fv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith3fv ( local  location,
local  floats,
local  numberOfArrays 
)

calls glUniform3fv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith3i ( GLint  location,
GLint  i1,
GLint  i2,
GLint  i3 
)

calls glUniform3i only if the values are different than the previous call for this same shader program.

var setUniformLocationWith3i ( var  location,
var  i1,
var  i2,
var  i3 
)

calls glUniform3i only if the values are different than the previous call for this same shader program.

local setUniformLocationWith3i ( local  location,
local  i1,
local  i2,
local  i3 
)

calls glUniform3i only if the values are different than the previous call for this same shader program.

void setUniformLocationWith3iv ( GLint  location,
GLint *  ints,
unsigned int  numberOfArrays 
)

calls glUniform3iv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith3iv ( var  location,
var  ints,
var  numberOfArrays 
)

calls glUniform3iv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith3iv ( local  location,
local  ints,
local  numberOfArrays 
)

calls glUniform3iv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith4f ( GLint  location,
GLfloat  f1,
GLfloat  f2,
GLfloat  f3,
GLfloat  f4 
)

calls glUniform4f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

local setUniformLocationWith4f ( local  location,
local  f1,
local  f2,
local  f3,
local  f4 
)

calls glUniform4f only if the values are different than the previous call for this same shader program.

In js or lua,please use setUniformLocationF32

void setUniformLocationWith4fv ( GLint  location,
const GLfloat *  floats,
unsigned int  numberOfArrays 
)

calls glUniform4fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith4fv ( var  location,
var  floats,
var  numberOfArrays 
)

calls glUniform4fv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith4fv ( local  location,
local  floats,
local  numberOfArrays 
)

calls glUniform4fv only if the values are different than the previous call for this same shader program.

void setUniformLocationWith4i ( GLint  location,
GLint  i1,
GLint  i2,
GLint  i3,
GLint  i4 
)

calls glUniform4i only if the values are different than the previous call for this same shader program.

var setUniformLocationWith4i ( var  location,
var  i1,
var  i2,
var  i3,
var  i4 
)

calls glUniform4i only if the values are different than the previous call for this same shader program.

local setUniformLocationWith4i ( local  location,
local  i1,
local  i2,
local  i3,
local  i4 
)

calls glUniform4i only if the values are different than the previous call for this same shader program.

void setUniformLocationWith4iv ( GLint  location,
GLint *  ints,
unsigned int  numberOfArrays 
)

calls glUniform4iv only if the values are different than the previous call for this same shader program.

var setUniformLocationWith4iv ( var  location,
var  ints,
var  numberOfArrays 
)

calls glUniform4iv only if the values are different than the previous call for this same shader program.

local setUniformLocationWith4iv ( local  location,
local  ints,
local  numberOfArrays 
)

calls glUniform4iv only if the values are different than the previous call for this same shader program.

void
setUniformLocationWithMatrix2fv
( GLint  location,
const GLfloat *  matrixArray,
unsigned int  numberOfMatrices 
)

calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWithMatrix2fv ( var  location,
var  matrixArray,
var  numberOfMatrices 
)

calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program.

local
setUniformLocationWithMatrix2fv
( local  location,
local  matrixArray,
local  numberOfMatrices 
)

calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program.

void
setUniformLocationWithMatrix3fv
( GLint  location,
const GLfloat *  matrixArray,
unsigned int  numberOfMatrices 
)

calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWithMatrix3fv ( var  location,
var  matrixArray,
var  numberOfMatrices 
)

calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program.

local
setUniformLocationWithMatrix3fv
( local  location,
local  matrixArray,
local  numberOfMatrices 
)

calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program.

void
setUniformLocationWithMatrix4fv
( GLint  location,
const GLfloat *  matrixArray,
unsigned int  numberOfMatrices 
)

calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program.

var setUniformLocationWithMatrix4fv ( var  location,
var  matrixArray,
var  numberOfMatrices 
)

calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program.

local
setUniformLocationWithMatrix4fv
( local  location,
local  matrixArray,
local  numberOfMatrices 
)

calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program.

void setUniformsForBuiltins ( )

will update the builtin uniforms if they are different than the previous call for this same shader program.

var setUniformsForBuiltins ( )

will update the builtin uniforms if they are different than the previous call for this same shader program.

local setUniformsForBuiltins ( )

will update the builtin uniforms if they are different than the previous call for this same shader program.

void setUniformsForBuiltins ( const Mat4 modelView)
var setUniformsForBuiltins ( var  modelView)
local setUniformsForBuiltins ( local  modelView)
bool updateUniformLocation ( GLint  location,
const GLvoid *  data,
unsigned int  bytes 
)
protected
var updateUniformLocation ( var  location,
var  data,
var  bytes 
)
protected
local updateUniformLocation ( local  location,
local  data,
local  bytes 
)
protected
void updateUniforms ( )

It will create 4 uniforms:

  • kUniformPMatrix
  • kUniformMVMatrix
  • kUniformMVPMatrix
  • GLProgram::UNIFORM_SAMPLER

And it will bind "GLProgram::UNIFORM_SAMPLER" to 0

var updateUniforms ( )

It will create 4 uniforms:

  • kUniformPMatrix
  • kUniformMVMatrix
  • kUniformMVPMatrix
  • GLProgram::UNIFORM_SAMPLER

And it will bind "GLProgram::UNIFORM_SAMPLER" to 0

local updateUniforms ( )

It will create 4 uniforms:

  • kUniformPMatrix
  • kUniformMVMatrix
  • kUniformMVPMatrix
  • GLProgram::UNIFORM_SAMPLER

And it will bind "GLProgram::UNIFORM_SAMPLER" to 0

void use ( )

it will call glUseProgram()

var use ( )

it will call glUseProgram()

local use ( )

it will call glUseProgram()

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
( uint32_t  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

GLint _builtInUniforms[UNIFORM_MAX]
protected
GLint _builtInUniforms[UNIFORM_MAX]
protected
GLint _builtInUniforms[UNIFORM_MAX]
protected
Director* _director
protected
var _director
protected
local _director
protected
struct
cocos2d::GLProgram::flag_struct
_flags
protected
var _flags
protected
local _flags
protected
GLuint _fragShader
protected
var _fragShader
protected
local _fragShader
protected
std::unordered_map<GLint,
std::pair<GLvoid*, unsigned
int> > _hashForUniforms
protected
var _hashForUniforms
protected
local _hashForUniforms
protected
bool _hasShaderCompiler
protected
var _hasShaderCompiler
protected
local _hasShaderCompiler
protected
GLuint _program
protected
std::string _shaderId
protected
var _shaderId
protected
local _shaderId
protected
std::unordered_map<std::string,
Uniform> _userUniforms
protected
var _userUniforms
protected
local _userUniforms
protected
std::unordered_map<std::string,
VertexAttrib> _vertexAttribs
protected
var _vertexAttribs
protected
local _vertexAttribs
protected
GLuint _vertShader
protected
var _vertShader
protected
local _vertShader
protected
const char*
ATTRIBUTE_NAME_BLEND_INDEX
static
var ATTRIBUTE_NAME_BLEND_INDEX
static
local ATTRIBUTE_NAME_BLEND_INDEX
static
const char*
ATTRIBUTE_NAME_BLEND_WEIGHT
static
var ATTRIBUTE_NAME_BLEND_WEIGHT
static
local ATTRIBUTE_NAME_BLEND_WEIGHT
static
const char* ATTRIBUTE_NAME_COLOR
static
var ATTRIBUTE_NAME_COLOR
static
local ATTRIBUTE_NAME_COLOR
static
const char* ATTRIBUTE_NAME_NORMAL
static
var ATTRIBUTE_NAME_NORMAL
static
local ATTRIBUTE_NAME_NORMAL
static
const char* ATTRIBUTE_NAME_POSITION
static
var ATTRIBUTE_NAME_POSITION
static
local ATTRIBUTE_NAME_POSITION
static
const char*
ATTRIBUTE_NAME_TEX_COORD
static
var ATTRIBUTE_NAME_TEX_COORD
static
local ATTRIBUTE_NAME_TEX_COORD
static
const char*
ATTRIBUTE_NAME_TEX_COORD1
static
var ATTRIBUTE_NAME_TEX_COORD1
static
local ATTRIBUTE_NAME_TEX_COORD1
static
const char*
ATTRIBUTE_NAME_TEX_COORD2
static
var ATTRIBUTE_NAME_TEX_COORD2
static
local ATTRIBUTE_NAME_TEX_COORD2
static
const char*
ATTRIBUTE_NAME_TEX_COORD3
static
var ATTRIBUTE_NAME_TEX_COORD3
static
local ATTRIBUTE_NAME_TEX_COORD3
static
CC_DLL const GLchar*
cc3D_Color_frag
var cc3D_Color_frag
local cc3D_Color_frag
CC_DLL const GLchar*
cc3D_ColorNormal_frag
var cc3D_ColorNormal_frag
local cc3D_ColorNormal_frag
CC_DLL const GLchar*
cc3D_ColorNormalTex_frag
var cc3D_ColorNormalTex_frag
local cc3D_ColorNormalTex_frag
CC_DLL const GLchar*
cc3D_ColorTex_frag
var cc3D_ColorTex_frag
local cc3D_ColorTex_frag
CC_DLL const GLchar*
cc3D_PositionNormalTex_vert
var cc3D_PositionNormalTex_vert
local cc3D_PositionNormalTex_vert
CC_DLL const GLchar*
cc3D_PositionTex_vert
var cc3D_PositionTex_vert
local cc3D_PositionTex_vert
CC_DLL const GLchar*
cc3D_SkinPositionNormalTex_vert
var cc3D_SkinPositionNormalTex_vert
local
cc3D_SkinPositionNormalTex_vert
CC_DLL const GLchar*
cc3D_SkinPositionTex_vert
var cc3D_SkinPositionTex_vert
local cc3D_SkinPositionTex_vert
CC_DLL const GLchar* ccLabel_vert
var ccLabel_vert
local ccLabel_vert
CC_DLL const GLchar*
ccLabelDistanceFieldGlow_frag
var ccLabelDistanceFieldGlow_frag
local ccLabelDistanceFieldGlow_frag
CC_DLL const GLchar*
ccLabelDistanceFieldNormal_frag
var ccLabelDistanceFieldNormal_frag
local
ccLabelDistanceFieldNormal_frag
CC_DLL const GLchar*
ccLabelNormal_frag
var ccLabelNormal_frag
local ccLabelNormal_frag
CC_DLL const GLchar*
ccLabelOutline_frag
var ccLabelOutline_frag
local ccLabelOutline_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*
ccPositionColorTextureAsPointsize_vert
var
ccPositionColorTextureAsPointsize_vert
local
ccPositionColorTextureAsPointsize_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
GLuint index
var index
local index
GLint location
var location
local location
std::string name
var name
local name
std::string name
var name
local name
const char* SHADER_3D_POSITION
static
var SHADER_3D_POSITION
static
local SHADER_3D_POSITION
static
const char*
SHADER_3D_POSITION_NORMAL
static
var SHADER_3D_POSITION_NORMAL
static
local SHADER_3D_POSITION_NORMAL
static
const char*
SHADER_3D_POSITION_NORMAL_TEXTURE
static
var
SHADER_3D_POSITION_NORMAL_TEXTURE
static
local
SHADER_3D_POSITION_NORMAL_TEXTURE
static
const char*
SHADER_3D_POSITION_TEXTURE
static
var SHADER_3D_POSITION_TEXTURE
static
local SHADER_3D_POSITION_TEXTURE
static
const char*
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static
var
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static
local
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static
const char*
SHADER_3D_SKINPOSITION_TEXTURE
static
var SHADER_3D_SKINPOSITION_TEXTURE
static
local
SHADER_3D_SKINPOSITION_TEXTURE
static
const char*
SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
static
var
SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
static
local
SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
static
const char*
SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
static
var
SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
static
local
SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
static
const char*
SHADER_NAME_LABEL_NORMAL
static
var SHADER_NAME_LABEL_NORMAL
static
local SHADER_NAME_LABEL_NORMAL
static
const char*
SHADER_NAME_LABEL_OUTLINE
static
var SHADER_NAME_LABEL_OUTLINE
static
local SHADER_NAME_LABEL_OUTLINE
static
const char*
SHADER_NAME_POSITION_COLOR
static
var SHADER_NAME_POSITION_COLOR
static
local SHADER_NAME_POSITION_COLOR
static
const char*
SHADER_NAME_POSITION_COLOR_NO_MVP
static
var
SHADER_NAME_POSITION_COLOR_NO_MVP
static
local
SHADER_NAME_POSITION_COLOR_NO_MVP
static
const char*
SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE
static
var
SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE
static
local
SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE
static
const char*
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static
var
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static
local
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static
const char*
SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
static
var
SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
static
local
SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
static
const char*
SHADER_NAME_POSITION_TEXTURE
static
var SHADER_NAME_POSITION_TEXTURE
static
local SHADER_NAME_POSITION_TEXTURE
static
const char*
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static
var
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static
local
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static
const char*
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static
var
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static
local
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static
const char*
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static
var
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static
local
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static
const char*
SHADER_NAME_POSITION_TEXTURE_COLOR
static
var
SHADER_NAME_POSITION_TEXTURE_COLOR
static
local
SHADER_NAME_POSITION_TEXTURE_COLOR
static
const char*
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static
var
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static
local
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static
const char*
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static
var
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static
local
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static
const char*
SHADER_NAME_POSITION_U_COLOR
static
var SHADER_NAME_POSITION_U_COLOR
static
local SHADER_NAME_POSITION_U_COLOR
static
GLint size
var size
local size
GLint size
var size
local size
GLenum type
var type
local type
GLenum type
var type
local type
const char*
UNIFORM_NAME_ALPHA_TEST_VALUE
static
var UNIFORM_NAME_ALPHA_TEST_VALUE
static
local UNIFORM_NAME_ALPHA_TEST_VALUE
static
const char*
UNIFORM_NAME_AMBIENT_COLOR
static
var UNIFORM_NAME_AMBIENT_COLOR
static
local UNIFORM_NAME_AMBIENT_COLOR
static
const char* UNIFORM_NAME_COS_TIME
static
var UNIFORM_NAME_COS_TIME
static
local UNIFORM_NAME_COS_TIME
static
const char* UNIFORM_NAME_MV_MATRIX
static
var UNIFORM_NAME_MV_MATRIX
static
local UNIFORM_NAME_MV_MATRIX
static
const char* UNIFORM_NAME_MVP_MATRIX
static
var UNIFORM_NAME_MVP_MATRIX
static
local UNIFORM_NAME_MVP_MATRIX
static
const char*
UNIFORM_NAME_NORMAL_MATRIX
static
var UNIFORM_NAME_NORMAL_MATRIX
static
local UNIFORM_NAME_NORMAL_MATRIX
static
const char* UNIFORM_NAME_P_MATRIX
static
var UNIFORM_NAME_P_MATRIX
static
local UNIFORM_NAME_P_MATRIX
static
const char* UNIFORM_NAME_RANDOM01
static
var UNIFORM_NAME_RANDOM01
static
local UNIFORM_NAME_RANDOM01
static
const char* UNIFORM_NAME_SAMPLER0
static
var UNIFORM_NAME_SAMPLER0
static
local UNIFORM_NAME_SAMPLER0
static
const char* UNIFORM_NAME_SAMPLER1
static
var UNIFORM_NAME_SAMPLER1
static
local UNIFORM_NAME_SAMPLER1
static
const char* UNIFORM_NAME_SAMPLER2
static
var UNIFORM_NAME_SAMPLER2
static
local UNIFORM_NAME_SAMPLER2
static
const char* UNIFORM_NAME_SAMPLER3
static
var UNIFORM_NAME_SAMPLER3
static
local UNIFORM_NAME_SAMPLER3
static
const char* UNIFORM_NAME_SIN_TIME
static
var UNIFORM_NAME_SIN_TIME
static
local UNIFORM_NAME_SIN_TIME
static
const char* UNIFORM_NAME_TIME
static
var UNIFORM_NAME_TIME
static
local UNIFORM_NAME_TIME
static
unsigned int usesMV
var usesMV
local usesMV
unsigned int usesMVP
var usesMVP
local usesMVP
unsigned int usesNormal
var usesNormal
local usesNormal
unsigned int usesP
var usesP
local usesP
unsigned int usesRandom
var usesRandom
local usesRandom
unsigned int usesTime
var usesTime
local usesTime

Friends

friend class GLProgramState
friend
var GLProgramState
friend
local GLProgramState
friend