cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
CCGLProgram Class that implements a glProgram. More...
#include <CCGLProgram.h>
Public Member Functions | |
CCGLProgram () | |
ctor NA More... | |
virtual | ~CCGLProgram () |
NA NA. More... | |
bool | initWithVertexShaderByteArray (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray) |
Initializes the CCGLProgram with a vertex and fragment with bytes array initWithString NA. More... | |
bool | initWithPrecompiledProgramByteArray (const GLchar *vShaderByteArray, const GLchar *fShaderByteArray) |
Initializes the CCGLProgram with precompiled shader program. More... | |
bool | initWithVertexShaderFilename (const char *vShaderFilename, const char *fShaderFilename) |
Initializes the CCGLProgram with a vertex and fragment with contents of filenames init NA. More... | |
void | addAttribute (const char *attributeName, GLuint index) |
It will add a new attribute to the shader NA. More... | |
bool | link () |
links the glProgram NA More... | |
void | use () |
it will call glUseProgram() NA More... | |
void | updateUniforms () |
It will create 4 uniforms: More... | |
GLint | getUniformLocationForName (const char *name) |
calls retrieves the named uniform location for this shader program. More... | |
void | setUniformLocationWith1i (GLint location, GLint i1) |
calls glUniform1i only if the values are different than the previous call for this same shader program. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | setUniformLocationWith1f (GLint location, GLfloat 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 | 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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | setUniformsForBuiltins () |
will update the builtin uniforms if they are different than the previous call for this same shader program. More... | |
const char * | vertexShaderLog () |
returns the vertexShader error log getVertexShaderLog NA More... | |
const char * | fragmentShaderLog () |
returns the fragmentShader error log getFragmentShaderLog NA More... | |
const char * | programLog () |
returns the program error log getProgramLog NA More... | |
void | reset () |
reload all shaders, this function is designed for android when opengl context lost, so don't call it. More... | |
const GLuint | getProgram () |
NA. More... | |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
![]() | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Protected Member Functions | |
bool | updateUniformLocation (GLint location, GLvoid *data, unsigned int bytes) |
const char * | description () |
bool | compileShader (GLuint *shader, GLenum type, const GLchar *source) |
const char * | logForOpenGLObject (GLuint object, GLInfoFunction infoFunc, GLLogFunction logFunc) |
Protected Attributes | |
GLuint | m_uProgram |
GLuint | m_uVertShader |
GLuint | m_uFragShader |
GLint | m_uUniforms [kCCUniform_MAX] |
struct _hashUniformEntry * | m_pHashForUniforms |
bool | m_bUsesTime |
bool | m_hasShaderCompiler |
std::string | m_shaderId |
![]() | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
int | m_nTag |
int | m_eObjType |
unsigned int | m_uObjectIdxInArray |
Additional Inherited Members | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
CCGLProgram Class that implements a glProgram.
CCGLProgram | ( | ) |
ctor NA
|
virtual |
NA NA.
void addAttribute | ( | const char * | attributeName, |
GLuint | index | ||
) |
It will add a new attribute to the shader NA.
|
protected |
|
protected |
const char * fragmentShaderLog | ( | ) |
returns the fragmentShader error log getFragmentShaderLog NA
|
inline |
NA.
GLint getUniformLocationForName | ( | const char * | name | ) |
calls retrieves the named uniform location for this shader program.
NA
bool initWithPrecompiledProgramByteArray | ( | const GLchar * | vShaderByteArray, |
const GLchar * | fShaderByteArray | ||
) |
Initializes the CCGLProgram with precompiled shader program.
bool initWithVertexShaderByteArray | ( | const GLchar * | vShaderByteArray, |
const GLchar * | fShaderByteArray | ||
) |
Initializes the CCGLProgram with a vertex and fragment with bytes array initWithString NA.
bool initWithVertexShaderFilename | ( | const char * | vShaderFilename, |
const char * | fShaderFilename | ||
) |
Initializes the CCGLProgram with a vertex and fragment with contents of filenames init NA.
bool link | ( | ) |
links the glProgram NA
|
protected |
const char * programLog | ( | ) |
returns the program error log getProgramLog NA
void reset | ( | ) |
reload all shaders, this function is designed for android when opengl context lost, so don't call it.
NA
void setUniformLocationWith1f | ( | GLint | location, |
GLfloat | f1 | ||
) |
calls glUniform1f only if the values are different than the previous call for this same shader program.
setUniformLocationF32 NA
void setUniformLocationWith1i | ( | GLint | location, |
GLint | i1 | ||
) |
calls glUniform1i only if the values are different than the previous call for this same shader program.
setUniformLocationI32 NA
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.
setUniformLocationF32 NA
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.
NA NA
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.
NA
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.
NA
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.
setUniformLocationF32 NA
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.
NA NA
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.
NA
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.
NA
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.
setUniformLocationF32 NA
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.
NA NA
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.
NA
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.
NA
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.
NA NA
void setUniformsForBuiltins | ( | ) |
will update the builtin uniforms if they are different than the previous call for this same shader program.
NA
|
protected |
void updateUniforms | ( | ) |
It will create 4 uniforms:
And it will bind "kCCUniformSampler" to 0 NA
void use | ( | ) |
it will call glUseProgram() NA
const char * vertexShaderLog | ( | ) |
returns the vertexShader error log getVertexShaderLog NA
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |