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
,)

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
,,
uintnumberOfArrays
)

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

voidsetUniformLocationWith3iv(
_::GLintlocation
,,
uintnumberOfArrays
)

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

voidsetUniformLocationWith4iv(
_::GLintlocation
,,
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
,,
uintnumberOfArrays
)

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

voidsetUniformLocationWith3fv(
_::GLintlocation
,,
uintnumberOfArrays
)

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

voidsetUniformLocationWith4fv(
_::GLintlocation
,,
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