CCGLProgram Class that implements a glProgram
Class CCGLProgram
#include <Geode/cocos/shaders/CCGLProgram.h>
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
boollink()
links the glProgram
voiduse()
it will call glUseProgram()
voidupdateUniforms()
It will create 4 uniforms:
- kCCUniformPMatrix
- kCCUniformMVMatrix
- kCCUniformMVPMatrix
- kCCUniformSampler And it will bind “kCCUniformSampler” to 0
_::GLintgetUniformLocationForName(charconst*name)
calls retrieves the named uniform location for this shader program.
voidsetUniformLocationWith1i(_::GLintlocation,_::GLinti1)
calls glUniform1i only if the values are different than the previous call for this same shader program.
voidsetUniformLocationWith2i(_::GLintlocation,_::GLinti1,_::GLinti2)
calls glUniform2i only if the values are different than the previous call for this same shader program.
voidsetUniformLocationWith3i(_::GLintlocation,_::GLinti1,_::GLinti2,_::GLinti3)
calls glUniform3i only if the values are different than the previous call for this same shader program.
voidsetUniformLocationWith4i(_::GLintlocation,_::GLinti1,_::GLinti2,_::GLinti3,_::GLinti4)
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.