|
cocos2d-x
2.1.1
|
CCGLProgram Class that implements a glProgram. More...
#include <CCGLProgram.h>
Public Member Functions | |
| CCGLProgram () | |
| virtual | ~CCGLProgram () |
| bool | initWithVertexShaderByteArray (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray) |
| Initializes the CCGLProgram with a vertex and fragment with bytes array. | |
| bool | initWithVertexShaderFilename (const char *vShaderFilename, const char *fShaderFilename) |
| Initializes the CCGLProgram with a vertex and fragment with contents of filenames. | |
| void | addAttribute (const char *attributeName, GLuint index) |
| It will add a new attribute to the shader. | |
| bool | link () |
| links the glProgram | |
| void | use () |
| it will call glUseProgram() | |
| void | updateUniforms () |
| It will create 4 uniforms: | |
| void | setUniformLocationWith1i (GLint location, GLint i1) |
| calls glUniform1i 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. | |
| 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. | |
| 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. | |
| 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. | |
| void | setUniformLocationWith2fv (GLint location, 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, 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, GLfloat *floats, unsigned int numberOfArrays) |
| calls glUniform4fv only if the values are different than the previous call for this same shader program. | |
| void | setUniformLocationWithMatrix4fv (GLint location, GLfloat *matrixArray, unsigned int 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. | |
| const char * | vertexShaderLog () |
| returns the vertexShader error log | |
| const char * | fragmentShaderLog () |
| returns the fragmentShader error log | |
| const char * | programLog () |
| returns the program error log | |
| void | reset () |
| const GLuint | getProgram () |
Public Member Functions inherited from CCObject | |
| CCObject (void) | |
| virtual | ~CCObject (void) |
| void | release (void) |
| void | retain (void) |
| CCObject * | autorelease (void) |
| CCObject * | copy (void) |
| bool | isSingleReference (void) |
| unsigned int | retainCount (void) |
| virtual bool | isEqual (const CCObject *pObject) |
| virtual void | update (float dt) |
Public Member Functions inherited from CCCopying | |
| virtual CCObject * | copyWithZone (CCZone *pZone) |
Additional Inherited Members | |
Public Attributes inherited from CCObject | |
| unsigned int | m_uID |
| int | m_nLuaID |
Protected Attributes inherited from CCObject | |
| unsigned int | m_uReference |
| unsigned int | m_uAutoReleaseCount |
Detailed Description
CCGLProgram Class that implements a glProgram.
- Since
- v2.0.0
Constructor & Destructor Documentation
| CCGLProgram | ( | ) |
|
virtual |
Member Function Documentation
| void addAttribute | ( | const char * | attributeName, |
| GLuint | index | ||
| ) |
It will add a new attribute to the shader.
| const char* fragmentShaderLog | ( | ) |
returns the fragmentShader error log
|
inline |
| bool initWithVertexShaderByteArray | ( | const GLchar * | vShaderByteArray, |
| const GLchar * | fShaderByteArray | ||
| ) |
Initializes the CCGLProgram with a vertex and fragment with bytes array.
| bool initWithVertexShaderFilename | ( | const char * | vShaderFilename, |
| const char * | fShaderFilename | ||
| ) |
Initializes the CCGLProgram with a vertex and fragment with contents of filenames.
| bool link | ( | ) |
links the glProgram
| const char* programLog | ( | ) |
returns the program error log
| void reset | ( | ) |
| void setUniformLocationWith1f | ( | GLint | location, |
| GLfloat | f1 | ||
| ) |
calls glUniform1f 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.
| 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.
| void setUniformLocationWith2fv | ( | GLint | location, |
| GLfloat * | floats, | ||
| unsigned int | numberOfArrays | ||
| ) |
calls glUniform2fv 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.
| void setUniformLocationWith3fv | ( | GLint | location, |
| GLfloat * | floats, | ||
| unsigned int | numberOfArrays | ||
| ) |
calls glUniform3fv 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.
| void setUniformLocationWith4fv | ( | GLint | location, |
| GLfloat * | floats, | ||
| unsigned int | numberOfArrays | ||
| ) |
calls glUniform4fv only if the values are different than the previous call for this same shader program.
| void setUniformLocationWithMatrix4fv | ( | GLint | location, |
| GLfloat * | matrixArray, | ||
| unsigned int | 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.
| void updateUniforms | ( | ) |
It will create 4 uniforms:
- kCCUniformPMatrix
- kCCUniformMVMatrix
- kCCUniformMVPMatrix
- kCCUniformSampler
And it will bind "kCCUniformSampler" to 0
| void use | ( | ) |
it will call glUseProgram()
| const char* vertexShaderLog | ( | ) |
returns the vertexShader error log
The documentation for this class was generated from the following file:
- /Users/zhangkoumyou/SourceCode/cocos2d-x/cocos2dx/shaders/CCGLProgram.h

Public Member Functions inherited from 