Cocos2d-x  v3.11
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
GLProgram Class Reference

Class that implements a openGL Program. More...

Inherits Ref.

Classes

struct  UniformFlags
 Flags used by the uniforms. More...
 

Public Types

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_TANGENT, VERTEX_ATTRIB_BINORMAL
}
 Enum the preallocated vertex attribute. More...
 
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
}
 Preallocated uniform handle. More...
 

Public Member Functions

 GLProgram ()
 Constructor.
 
virtual ~GLProgram ()
 Destructor.
 
local ~GLProgram ()
 Destructor.
 
bool initWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
 Init the GLProgram with a vertex and fragment with bytes array. More...
 
bool initWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray, const std::string &compileTimeDefines)
 Init the GLProgram with a vertex and fragment with bytes array. More...
 
bool initWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
 Init the GLProgram with a vertex and fragment file. More...
 
bool initWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename, const std::string &compileTimeDefines)
 Init the GLProgram with a vertex and fragment file. More...
 
UniformgetUniform (const std::string &name)
 Get the uniform by string name in shader, return null if it does not exist.
 
VertexAttribgetVertexAttrib (const std::string &name)
 Get the vertex attribute by string name in shader, return null if it does not exist.
 
var getVertexAttrib ( var name)
 Get the vertex attribute by string name in shader, return null if it does not exist.
 
local getVertexAttrib ( local name)
 Get the vertex attribute by string name in shader, return null if it does not exist.
 
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.
 
var getAttribLocation ( var attributeName)
 Calls glGetAttribLocation.
 
local getAttribLocation ( local attributeName)
 Calls glGetAttribLocation.
 
GLint getUniformLocation (const std::string &attributeName) const
 Calls glGetUniformLocation().
 
var getUniformLocation ( var attributeName)
 Calls glGetUniformLocation().
 
local getUniformLocation ( local attributeName)
 Calls glGetUniformLocation().
 
bool link ()
 links the glProgram
 
var link ()
 links the glProgram
 
local link ()
 links the glProgram
 
void use ()
 it will call glUseProgram()
 
var use ()
 it will call glUseProgram()
 
local use ()
 it will call glUseProgram()
 
void updateUniforms ()
 update the locations for built in uniforms.
 
var updateUniforms ()
 update the locations for built in uniforms.
 
local updateUniforms ()
 update the locations for built in uniforms.
 
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.
 
void setUniformLocationWith1i (GLint location, GLint i1)
 calls glUniform1i 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.
 
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.
 
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.
 
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.
 
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 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 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...
 
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...
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
void setUniformsForBuiltins ()
 Update the builtin uniforms if they are different than the previous call for this same shader program.
 
void setUniformsForBuiltins (const Mat4 &modelView)
 Update the builtin uniforms if they are different than the previous call for this same shader program. More...
 
std::string getVertexShaderLog () const
 returns the vertexShader error log
 
std::string getFragmentShaderLog () const
 returns the fragmentShader error log
 
var getFragmentShaderLog ()
 returns the fragmentShader error log
 
local getFragmentShaderLog ()
 returns the fragmentShader error log
 
std::string getProgramLog () const
 returns the program error log
 
var getProgramLog ()
 returns the program error log
 
local getProgramLog ()
 returns the program error log
 
void reset ()
 Reload all shaders, this function is designed for android when opengl context lost, so don't call it.
 
const UniformFlagsgetUniformFlags () const
 returns the Uniform flags
 
var getUniformFlags ()
 returns the Uniform flags
 
local getUniformFlags ()
 returns the Uniform flags
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Static Public Member Functions

static GLProgramcreateWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
var initWithString. ( var vShaderByteArray, var fShaderByteArray)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
local initWithString. ( local vShaderByteArray, local fShaderByteArray)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
static GLProgramcreateWithByteArrays (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray, const std::string &compileTimeDefines)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
var createWithByteArrays ( var vShaderByteArray, var fShaderByteArray, var compileTimeDefines)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
local createWithByteArrays ( local vShaderByteArray, local fShaderByteArray, local compileTimeDefines)
 Create the GLProgram with a vertex and fragment with bytes array. More...
 
static GLProgramcreateWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
 Create the GLProgram with a vertex and fragment file. More...
 
local init ( local vShaderFilename, local fShaderFilename)
 Create the GLProgram with a vertex and fragment file. More...
 
static GLProgramcreateWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename, const std::string &compileTimeDefines)
 Create the GLProgram with a vertex and fragment file. More...
 
var createWithFilenames ( var vShaderFilename, var fShaderFilename, var compileTimeDefines)
 Create the GLProgram with a vertex and fragment file. More...
 
local createWithFilenames ( local vShaderFilename, local fShaderFilename, local compileTimeDefines)
 Create the GLProgram with a vertex and fragment file. More...
 

Static Public Attributes

Built Shader types
static const char * SHADER_NAME_POSITION_TEXTURE_COLOR
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_COLOR
 Built in shader for 2d. More...
 
var SHADER_NAME_POSITION_COLOR
 Built in shader for 2d. More...
 
local SHADER_NAME_POSITION_COLOR
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_COLOR_NO_MVP
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE
 Built in shader for 2d. More...
 
var SHADER_NAME_POSITION_TEXTURE
 Built in shader for 2d. More...
 
local SHADER_NAME_POSITION_TEXTURE
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE_U_COLOR
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_TEXTURE_A8_COLOR
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_U_COLOR
 Built in shader for 2d. More...
 
var SHADER_NAME_POSITION_U_COLOR
 Built in shader for 2d. More...
 
local SHADER_NAME_POSITION_U_COLOR
 Built in shader for 2d. More...
 
static const char * SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
 Built in shader for draw a sector with 90 degrees with center at bottom left point.
 
static const char * SHADER_NAME_POSITION_GRAYSCALE
 Built in shader for ui effects.
 
var SHADER_NAME_POSITION_GRAYSCALE
 Built in shader for ui effects.
 
local SHADER_NAME_POSITION_GRAYSCALE
 Built in shader for ui effects.
 
static const char * SHADER_NAME_LABEL_NORMAL
 Built in shader for label.
 
var SHADER_NAME_LABEL_NORMAL
 Built in shader for label.
 
local SHADER_NAME_LABEL_NORMAL
 Built in shader for label.
 
static const char * SHADER_NAME_LABEL_OUTLINE
 Built in shader for label outline effects.
 
var SHADER_NAME_LABEL_OUTLINE
 Built in shader for label outline effects.
 
local SHADER_NAME_LABEL_OUTLINE
 Built in shader for label outline effects.
 
static const char * SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
 Built in shader for label based on DISTANCEFIELD.
 
static const char * SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
 Built in shader for label based on DISTANCEFIELD.
 
static const char * SHADER_3D_POSITION
 Built in shader used for 3D, support Position vertex attribute, with color specified by a uniform.
 
var SHADER_3D_POSITION
 Built in shader used for 3D, support Position vertex attribute, with color specified by a uniform.
 
local SHADER_3D_POSITION
 Built in shader used for 3D, support Position vertex attribute, with color specified by a uniform.
 
static const char * SHADER_3D_POSITION_TEXTURE
 Built in shader used for 3D, support Position and Texture vertex attribute, with color specified by a uniform.
 
var SHADER_3D_POSITION_TEXTURE
 Built in shader used for 3D, support Position and Texture vertex attribute, with color specified by a uniform.
 
local SHADER_3D_POSITION_TEXTURE
 Built in shader used for 3D, support Position and Texture vertex attribute, with color specified by a uniform.
 
static const char * SHADER_3D_SKINPOSITION_TEXTURE
 Built in shader used for 3D, support Position (Skeletal animation by hardware skin) and Texture vertex attribute, with color specified by a uniform.
 
local SHADER_3D_SKINPOSITION_TEXTURE
 Built in shader used for 3D, support Position (Skeletal animation by hardware skin) and Texture vertex attribute, with color specified by a uniform.
 
static const char * SHADER_3D_POSITION_NORMAL
 Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting. More...
 
var SHADER_3D_POSITION_NORMAL
 Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting. More...
 
local SHADER_3D_POSITION_NORMAL
 Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting. More...
 
static const char * SHADER_3D_POSITION_NORMAL_TEXTURE
 Built in shader used for 3D, support Position, Normal, Texture vertex attribute, used in lighting. More...
 
static const char * SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
 Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting. More...
 
var SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
 Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting. More...
 
local SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
 Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting. More...
 
static const char * SHADER_3D_POSITION_BUMPEDNORMAL_TEXTURE
 Built in shader used for 3D, support Position, Bumped Normal, Texture vertex attribute, used in lighting. More...
 
static const char * SHADER_3D_SKINPOSITION_BUMPEDNORMAL_TEXTURE
 Built in shader used for 3D, support Position(skeletal animation by hardware skin), Bumped Normal, Texture vertex attribute, used in lighting. More...
 
static const char * SHADER_3D_PARTICLE_TEXTURE
 Built in shader for particles, support Position and Texture, with a color specified by a uniform.
 
static const char * SHADER_3D_PARTICLE_COLOR
 Built in shader for particles, support Position, with a color specified by a uniform.
 
var SHADER_3D_PARTICLE_COLOR
 Built in shader for particles, support Position, with a color specified by a uniform.
 
local SHADER_3D_PARTICLE_COLOR
 Built in shader for particles, support Position, with a color specified by a uniform.
 
static const char * SHADER_3D_SKYBOX
 Built in shader for skybox.
 
var SHADER_3D_SKYBOX
 Built in shader for skybox.
 
local SHADER_3D_SKYBOX
 Built in shader for skybox.
 
static const char * SHADER_3D_TERRAIN
 Built in shader for terrain.
 
var SHADER_3D_TERRAIN
 Built in shader for terrain.
 
local SHADER_3D_TERRAIN
 Built in shader for terrain.
 
static const char * SHADER_CAMERA_CLEAR
 Built in shader for camera clear.
 
var SHADER_CAMERA_CLEAR
 Built in shader for camera clear.
 
local SHADER_CAMERA_CLEAR
 Built in shader for camera clear.
 
Built uniform names
static const char * UNIFORM_NAME_AMBIENT_COLOR
 Ambient Color uniform.
 
var UNIFORM_NAME_AMBIENT_COLOR
 Ambient Color uniform.
 
local UNIFORM_NAME_AMBIENT_COLOR
 Ambient Color uniform.
 
static const char * UNIFORM_NAME_P_MATRIX
 Projection Matrix uniform.
 
var UNIFORM_NAME_P_MATRIX
 Projection Matrix uniform.
 
local UNIFORM_NAME_P_MATRIX
 Projection Matrix uniform.
 
static const char * UNIFORM_NAME_MV_MATRIX
 Model view matrix uniform.
 
var UNIFORM_NAME_MV_MATRIX
 Model view matrix uniform.
 
local UNIFORM_NAME_MV_MATRIX
 Model view matrix uniform.
 
static const char * UNIFORM_NAME_MVP_MATRIX
 Model view projection uniform.
 
var UNIFORM_NAME_MVP_MATRIX
 Model view projection uniform.
 
local UNIFORM_NAME_MVP_MATRIX
 Model view projection uniform.
 
static const char * UNIFORM_NAME_NORMAL_MATRIX
 Normal matrix uniform.
 
var UNIFORM_NAME_NORMAL_MATRIX
 Normal matrix uniform.
 
local UNIFORM_NAME_NORMAL_MATRIX
 Normal matrix uniform.
 
static const char * UNIFORM_NAME_TIME
 Time uniform.
 
var UNIFORM_NAME_TIME
 Time uniform.
 
local UNIFORM_NAME_TIME
 Time uniform.
 
static const char * UNIFORM_NAME_SIN_TIME
 Sin time uniform.
 
var UNIFORM_NAME_SIN_TIME
 Sin time uniform.
 
local UNIFORM_NAME_SIN_TIME
 Sin time uniform.
 
static const char * UNIFORM_NAME_COS_TIME
 Cos time uniform.
 
var UNIFORM_NAME_COS_TIME
 Cos time uniform.
 
local UNIFORM_NAME_COS_TIME
 Cos time uniform.
 
static const char * UNIFORM_NAME_RANDOM01
 Random number uniform.
 
var UNIFORM_NAME_RANDOM01
 Random number uniform.
 
local UNIFORM_NAME_RANDOM01
 Random number uniform.
 
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
 Alpha test value uniform.
 
var UNIFORM_NAME_ALPHA_TEST_VALUE
 Alpha test value uniform.
 
local UNIFORM_NAME_ALPHA_TEST_VALUE
 Alpha test value uniform.
 
Built Attribute names
static const char * ATTRIBUTE_NAME_COLOR
 Attribute color.
 
var ATTRIBUTE_NAME_COLOR
 Attribute color.
 
local ATTRIBUTE_NAME_COLOR
 Attribute color.
 
static const char * ATTRIBUTE_NAME_POSITION
 Attribute position.
 
var ATTRIBUTE_NAME_POSITION
 Attribute position.
 
local ATTRIBUTE_NAME_POSITION
 Attribute position.
 
static const char * ATTRIBUTE_NAME_TEX_COORD
 Attribute Texcoord 0.
 
var ATTRIBUTE_NAME_TEX_COORD
 Attribute Texcoord 0.
 
local ATTRIBUTE_NAME_TEX_COORD
 Attribute Texcoord 0.
 
static const char * ATTRIBUTE_NAME_TEX_COORD1
 Attribute Texcoord 1.
 
var ATTRIBUTE_NAME_TEX_COORD1
 Attribute Texcoord 1.
 
local ATTRIBUTE_NAME_TEX_COORD1
 Attribute Texcoord 1.
 
static const char * ATTRIBUTE_NAME_TEX_COORD2
 Attribute Texcoord 2.
 
var ATTRIBUTE_NAME_TEX_COORD2
 Attribute Texcoord 2.
 
local ATTRIBUTE_NAME_TEX_COORD2
 Attribute Texcoord 2.
 
static const char * ATTRIBUTE_NAME_TEX_COORD3
 Attribute Texcoord 3.
 
var ATTRIBUTE_NAME_TEX_COORD3
 Attribute Texcoord 3.
 
local ATTRIBUTE_NAME_TEX_COORD3
 Attribute Texcoord 3.
 
static const char * ATTRIBUTE_NAME_NORMAL
 Attribute normal.
 
var ATTRIBUTE_NAME_NORMAL
 Attribute normal.
 
local ATTRIBUTE_NAME_NORMAL
 Attribute normal.
 
static const char * ATTRIBUTE_NAME_BLEND_WEIGHT
 Attribute blend weight.
 
var ATTRIBUTE_NAME_BLEND_WEIGHT
 Attribute blend weight.
 
local ATTRIBUTE_NAME_BLEND_WEIGHT
 Attribute blend weight.
 
static const char * ATTRIBUTE_NAME_BLEND_INDEX
 Attribute blend index.
 
var ATTRIBUTE_NAME_BLEND_INDEX
 Attribute blend index.
 
local ATTRIBUTE_NAME_BLEND_INDEX
 Attribute blend index.
 
static const char * ATTRIBUTE_NAME_TANGENT
 Attribute blend tangent. More...
 
var ATTRIBUTE_NAME_TANGENT
 Attribute blend tangent. More...
 
local ATTRIBUTE_NAME_TANGENT
 Attribute blend tangent. More...
 
static const char * ATTRIBUTE_NAME_BINORMAL
 Attribute blend binormal. More...
 
var ATTRIBUTE_NAME_BINORMAL
 Attribute blend binormal. More...
 
local ATTRIBUTE_NAME_BINORMAL
 Attribute blend binormal. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

Class that implements a openGL Program.

Member Function Documentation

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

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

The source code of vertex shader. The source code of fragment shader. The result GLProgram.

var initWithString. ( var  vShaderByteArray,
var  fShaderByteArray 
)
static

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

The source code of vertex shader. The source code of fragment shader. The result GLProgram.

local initWithString. ( local  vShaderByteArray,
local  fShaderByteArray 
)
static

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

The source code of vertex shader. The source code of fragment shader. The result GLProgram.

bool initWithByteArrays ( const GLchar *  vShaderByteArray,
const GLchar *  fShaderByteArray 
)

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

The source code of vertex shader. The source code of fragment shader. The GLprogram is inited correctly or not.

var initWithByteArrays ( var  vShaderByteArray,
var  fShaderByteArray 
)

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

The source code of vertex shader. The source code of fragment shader. The GLprogram is inited correctly or not.

local initWithByteArrays ( local  vShaderByteArray,
local  fShaderByteArray 
)

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

The source code of vertex shader. The source code of fragment shader. The GLprogram is inited correctly or not.

static GLProgram*
createWithByteArrays
( const GLchar *  vShaderByteArray,
const GLchar *  fShaderByteArray,
const std::string &  compileTimeDefines 
)
static

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The result GLProgram.

var createWithByteArrays ( var  vShaderByteArray,
var  fShaderByteArray,
var  compileTimeDefines 
)
static

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The result GLProgram.

local createWithByteArrays ( local  vShaderByteArray,
local  fShaderByteArray,
local  compileTimeDefines 
)
static

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The result GLProgram.

bool initWithByteArrays ( const GLchar *  vShaderByteArray,
const GLchar *  fShaderByteArray,
const std::string &  compileTimeDefines 
)

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

var initWithByteArrays ( var  vShaderByteArray,
var  fShaderByteArray,
var  compileTimeDefines 
)

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

local initWithByteArrays ( local  vShaderByteArray,
local  fShaderByteArray,
local  compileTimeDefines 
)

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

The source code of vertex shader. The source code of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

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

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The result GLProgram.

var init ( var  vShaderFilename,
var  fShaderFilename 
)
static

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The result GLProgram.

local init ( local  vShaderFilename,
local  fShaderFilename 
)
static

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The result GLProgram.

bool initWithFilenames ( const std::string &  vShaderFilename,
const std::string &  fShaderFilename 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The GLprogram is inited correctly or not.

var initWithFilenames ( var  vShaderFilename,
var  fShaderFilename 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The GLprogram is inited correctly or not.

local initWithFilenames ( local  vShaderFilename,
local  fShaderFilename 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. The GLprogram is inited correctly or not.

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

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The result GLProgram.

var createWithFilenames ( var  vShaderFilename,
var  fShaderFilename,
var  compileTimeDefines 
)
static

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The result GLProgram.

local createWithFilenames ( local  vShaderFilename,
local  fShaderFilename,
local  compileTimeDefines 
)
static

Create the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The result GLProgram.

bool initWithFilenames ( const std::string &  vShaderFilename,
const std::string &  fShaderFilename,
const std::string &  compileTimeDefines 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

var initWithFilenames ( var  vShaderFilename,
var  fShaderFilename,
var  compileTimeDefines 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

local initWithFilenames ( local  vShaderFilename,
local  fShaderFilename,
local  compileTimeDefines 
)

Init the GLProgram with a vertex and fragment file.

The source code file of vertex shader. The source code file of fragment shader. compile macro and defines for shader. The GLprogram is inited correctly or not.

void bindAttribLocation ( const std::string &  attributeName,
GLuint  index 
) const

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

the name of vertex attribute. the index location.

var bindAttribLocation ( var  attributeName,
var  index 
)

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

the name of vertex attribute. the index location.

local bindAttribLocation ( local  attributeName,
local  index 
)

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

the name of vertex attribute. the index location.

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 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 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 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 setUniformsForBuiltins ( const Mat4 modelView)

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

modelView matrix applied to the built in uniform of the shader.

var setUniformsForBuiltins ( var  modelView)

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

modelView matrix applied to the built in uniform of the shader.

local setUniformsForBuiltins ( local  modelView)

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

modelView matrix applied to the built in uniform of the shader.

Member Data Documentation

const char*
SHADER_NAME_POSITION_TEXTURE_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute.

var
SHADER_NAME_POSITION_TEXTURE_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute.

local
SHADER_NAME_POSITION_TEXTURE_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute.

const char*
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, but without multiply vertex by MVP matrix.

var
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, but without multiply vertex by MVP matrix.

local
SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, but without multiply vertex by MVP matrix.

const char*
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static

Built in shader for 2d.

Support Position, Texture vertex attribute, but include alpha test.

var
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static

Built in shader for 2d.

Support Position, Texture vertex attribute, but include alpha test.

local
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static

Built in shader for 2d.

Support Position, Texture vertex attribute, but include alpha test.

const char*
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, include alpha test and without multiply vertex by MVP matrix.

var
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, include alpha test and without multiply vertex by MVP matrix.

local
SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute, include alpha test and without multiply vertex by MVP matrix.

const char*
SHADER_NAME_POSITION_COLOR
static

Built in shader for 2d.

Support Position, Color vertex attribute.

var SHADER_NAME_POSITION_COLOR
static

Built in shader for 2d.

Support Position, Color vertex attribute.

local SHADER_NAME_POSITION_COLOR
static

Built in shader for 2d.

Support Position, Color vertex attribute.

const char*
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static

Built in shader for 2d.

Support Position, Color, Texture vertex attribute. texture coordinate will used as point size.

var
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static

Built in shader for 2d.

Support Position, Color, Texture vertex attribute. texture coordinate will used as point size.

local
SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE
static

Built in shader for 2d.

Support Position, Color, Texture vertex attribute. texture coordinate will used as point size.

const char*
SHADER_NAME_POSITION_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Color vertex attribute, without multiply vertex by MVP matrix.

var
SHADER_NAME_POSITION_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Color vertex attribute, without multiply vertex by MVP matrix.

local
SHADER_NAME_POSITION_COLOR_NO_MVP
static

Built in shader for 2d.

Support Position, Color vertex attribute, without multiply vertex by MVP matrix.

const char*
SHADER_NAME_POSITION_TEXTURE
static

Built in shader for 2d.

Support Position, Texture vertex attribute.

var SHADER_NAME_POSITION_TEXTURE
static

Built in shader for 2d.

Support Position, Texture vertex attribute.

local SHADER_NAME_POSITION_TEXTURE
static

Built in shader for 2d.

Support Position, Texture vertex attribute.

const char*
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static

Built in shader for 2d.

Support Position, Texture vertex attribute. with a specified uniform as color

var
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static

Built in shader for 2d.

Support Position, Texture vertex attribute. with a specified uniform as color

local
SHADER_NAME_POSITION_TEXTURE_U_COLOR
static

Built in shader for 2d.

Support Position, Texture vertex attribute. with a specified uniform as color

const char*
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute. but alpha will be the multiplication of color attribute and texture.

var
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute. but alpha will be the multiplication of color attribute and texture.

local
SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static

Built in shader for 2d.

Support Position, Texture and Color vertex attribute. but alpha will be the multiplication of color attribute and texture.

const char*
SHADER_NAME_POSITION_U_COLOR
static

Built in shader for 2d.

Support Position, with color specified by a uniform.

var SHADER_NAME_POSITION_U_COLOR
static

Built in shader for 2d.

Support Position, with color specified by a uniform.

local SHADER_NAME_POSITION_U_COLOR
static

Built in shader for 2d.

Support Position, with color specified by a uniform.

const char*
SHADER_3D_POSITION_NORMAL
static

Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting.

with color specified by a uniform.

var SHADER_3D_POSITION_NORMAL
static

Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting.

with color specified by a uniform.

local SHADER_3D_POSITION_NORMAL
static

Built in shader used for 3D, support Position and Normal vertex attribute, used in lighting.

with color specified by a uniform.

const char*
SHADER_3D_POSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

var
SHADER_3D_POSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

local
SHADER_3D_POSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

const char*
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

var
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

local
SHADER_3D_SKINPOSITION_NORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

const char*
SHADER_3D_POSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

var
SHADER_3D_POSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

local
SHADER_3D_POSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position, Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

const char*
SHADER_3D_SKINPOSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

var
SHADER_3D_SKINPOSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

local
SHADER_3D_SKINPOSITION_BUMPEDNORMAL_TEXTURE
static

Built in shader used for 3D, support Position(skeletal animation by hardware skin), Bumped Normal, Texture vertex attribute, used in lighting.

with color specified by a uniform.

const char* ATTRIBUTE_NAME_TANGENT
static

Attribute blend tangent.

var ATTRIBUTE_NAME_TANGENT
static

Attribute blend tangent.

local ATTRIBUTE_NAME_TANGENT
static

Attribute blend tangent.

const char* ATTRIBUTE_NAME_BINORMAL
static

Attribute blend binormal.

var ATTRIBUTE_NAME_BINORMAL
static

Attribute blend binormal.

local ATTRIBUTE_NAME_BINORMAL
static

Attribute blend binormal.


The documentation for this class was generated from the following file: