Class CCGLProgram

#include <Geode/cocos/shaders/CCGLProgram.h>
classCCGLProgram:publiccocos2d::CCObject{ ... }

Since v2.0.0

CCGLProgram Class that implements a glProgram

Examples0
Public static methods0
Public member functions29
boolinitWithVertexShaderByteArray(
GLcharconst*vShaderByteArray
,
GLcharconst*fShaderByteArray
)

Initializes the CCGLProgram with a vertex and fragment with bytes array

boolinitWithVertexShaderFilename(
charconst*vShaderFilename
,
charconst*fShaderFilename
)

Initializes the CCGLProgram with a vertex and fragment with contents of filenames

voidaddAttribute(
charconst*attributeName
,
GLuintindex
)

It will add a new attribute to the shader

voiduse()

it will call glUseProgram()

voidupdateUniforms()

It will create 4 uniforms:

  • kCCUniformPMatrix
  • kCCUniformMVMatrix
  • kCCUniformMVPMatrix
  • kCCUniformSampler And it will bind “kCCUniformSampler” to 0
GLintgetUniformLocationForName()

calls retrieves the named uniform location for this shader program.

voidsetUniformLocationWith1i(
GLintlocation
,)

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

voidsetUniformLocationWith2i(
GLintlocation
,,)

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

voidsetUniformLocationWith3i(
GLintlocation
,,,)

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

voidsetUniformLocationWith4i(
GLintlocation
,,,,)

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

voidsetUniformLocationWith2iv(
GLintlocation
,
GLint*ints
,
uintnumberOfArrays
)

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

voidsetUniformLocationWith3iv(
GLintlocation
,
GLint*ints
,
uintnumberOfArrays
)

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

voidsetUniformLocationWith4iv(
GLintlocation
,
GLint*ints
,
uintnumberOfArrays
)

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

voidsetUniformLocationWith1f(
GLintlocation
,)

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

voidsetUniformLocationWith2f(
GLintlocation
,,)

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

voidsetUniformLocationWith3f(
GLintlocation
,,,)

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

voidsetUniformLocationWith4f(
GLintlocation
,,,,)

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

voidsetUniformLocationWith2fv(
GLintlocation
,
GLfloat*floats
,
uintnumberOfArrays
)

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

voidsetUniformLocationWith3fv(
GLintlocation
,
GLfloat*floats
,
uintnumberOfArrays
)

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

voidsetUniformLocationWith4fv(
GLintlocation
,
GLfloat*floats
,
uintnumberOfArrays
)

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

voidsetUniformLocationWithMatrix4fv(
GLintlocation
,
GLfloat*matrixArray
,
uintnumberOfMatrices
)

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

voidsetUniformsForBuiltins()

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

charconst*vertexShaderLog()

returns the vertexShader error log

charconst*fragmentShaderLog()

returns the fragmentShader error log

charconst*programLog()

returns the program error log

voidreset()

reload all shaders, this function is designed for android when opengl context lost, so don’t call it.

GLuintconstgetProgram()
No description provided
voidsetUniformLocationWithMatrix3fv(,,)
No description provided
Fields0
Protected member functions0
Protected fields7
GLuintm_uProgram
;
No description provided
GLuintm_uVertShader
;
No description provided
GLuintm_uFragShader
;
No description provided
GLint[8]m_uUniforms
;
No description provided
cocos2d::_hashUniformEntry*m_pHashForUniforms
;
No description provided
boolm_bUsesTime
;
No description provided
boolm_hasShaderCompiler
;
No description provided