cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
文件 - 图1 文件 - 图2)

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

文件 | 命名空间 | | 类型定义 | 枚举 | 枚举值 | 函数 | 变量 | 友元

Shaders

## 文件
文件 ccGLStateCache.h
## 命名空间
cocos2d::GL
##
struct VertexAttrib
struct Uniform
class GLProgram
GLProgram类 实现一个glProgram. 更多…
struct GLProgram::flag_struct
class GLProgramCache
GLProgramCache 单例的用于存储管理GL编程对象(shaders着色器) 更多…
## 类型定义
typedef void( GLInfoFunction )(GLuint program, GLenum pname, GLint params)
typedef void( GLLogFunction )(GLuint program, GLsizei bufsize, GLsizei length, GLchar *infolog)
## 枚举
enum { VERTEX_ATTRIB_POSITION, VERTEX_ATTRIB_COLOR, VERTEX_ATTRIB_TEX_COORD, VERTEX_ATTRIB_NORMAL, VERTEX_ATTRIB_MAX, VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD }
enum { UNIFORM_P_MATRIX, UNIFORM_MV_MATRIX, UNIFORM_MVP_MATRIX, UNIFORM_TIME, UNIFORM_SIN_TIME, UNIFORM_COS_TIME, UNIFORM_RANDOM01, UNIFORM_SAMPLER0, UNIFORM_SAMPLER1, UNIFORM_SAMPLER2, UNIFORM_SAMPLER3, UNIFORM_MAX }
enum { VERTEX_ATTRIB_FLAG_NONE = 0, VERTEX_ATTRIB_FLAG_POSITION = 1 << 0, VERTEX_ATTRIB_FLAG_COLOR = 1 << 1, VERTEX_ATTRIB_FLAG_TEX_COORD = 1 << 2, VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = (VERTEX_ATTRIB_FLAG_POSITION | VERTEX_ATTRIB_FLAG_COLOR | VERTEX_ATTRIB_FLAG_TEX_COORD) }
顶点(vertex)的属性标志 更多…
## 函数
GLProgram ()
virtual ~GLProgram ()
static GLProgram createWithPrecompiledProgramByteArray (const GLchar vShaderByteArray, const GLchar fShaderByteArray)
使用顶点(vertex)和片段字节数组初始化GLProgram initWithString initWithString 更多…
bool initWithPrecompiledProgramByteArray (const GLchar vShaderByteArray, const GLchar fShaderByteArray)
static GLProgram createWithByteArrays (const GLchar vShaderByteArray, const GLchar fShaderByteArray)
使用顶点(vertex)和字节数组片段初始化GLProgram initWithString initWithString 更多…
bool initWithByteArrays (const GLchar vShaderByteArray, const GLchar fShaderByteArray)
static GLProgram createWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
使用顶点(vertex)和文件名的内容片段初始化GLProgram init init 更多…
bool initWithFilenames (const std::string &vShaderFilename, const std::string &fShaderFilename)
Uniform getUniform (const std::string &name)
VertexAttrib getVertexAttrib (const std::string &name)
void bindAttribLocation (const std::string &attributeName, GLuint index) const
通过调用glBindAttribLocation方法添加新的属性到着色器(shader) 更多…
GLint getAttribLocation (const std::string &attributeName) const
调用 glGetAttribLocation方法 更多…
GLint getUniformLocation (const std::string &attributeName) const
调用 glGetUniformLocation()方法 更多…
bool link ()
链接 glProgram 更多…
void use ()
它将调用glUseProgram()方法 更多…
void updateUniforms ()
它将创建4种制式(uniforms): 更多…
GLint getUniformLocationForName (const char name) const
调用(retrieves)检索此着色器编程的指定名字制式的位置. 更多…
void setUniformLocationWith1i (GLint location, GLint i1)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform1i. 更多…
void setUniformLocationWith2i (GLint location, GLint i1, GLint i2)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2i. 更多…
void setUniformLocationWith3i (GLint location, GLint i1, GLint i2, GLint i3)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3i. 更多…
void setUniformLocationWith4i (GLint location, GLint i1, GLint i2, GLint i3, GLint i4)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4i,仅仅当该值不同于前一个,相同的着色器(shader)编程才调. 更多…
void setUniformLocationWith2iv (GLint location, GLint ints, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2iv. 更多…
void setUniformLocationWith3iv (GLint location, GLint ints, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3iv. 更多…
void setUniformLocationWith4iv (GLint location, GLint ints, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4iv. 更多…
void setUniformLocationWith1f (GLint location, GLfloat f1)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform1f . 更多…
void setUniformLocationWith2f (GLint location, GLfloat f1, GLfloat f2)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2f . 更多…
void setUniformLocationWith3f (GLint location, GLfloat f1, GLfloat f2, GLfloat f3)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3f. 更多…
void setUniformLocationWith4f (GLint location, GLfloat f1, GLfloat f2, GLfloat f3, GLfloat f4)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4f. 更多…
void setUniformLocationWith2fv (GLint location, const GLfloat floats, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2fv. 更多…
void setUniformLocationWith3fv (GLint location, const GLfloat floats, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3fv. 更多…
void setUniformLocationWith4fv (GLint location, const GLfloat floats, unsigned int numberOfArrays)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4fv. 更多…
void setUniformLocationWithMatrix2fv (GLint location, const GLfloat matrixArray, unsigned int numberOfMatrices)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix2fv. 更多…
void setUniformLocationWithMatrix3fv (GLint location, const GLfloat matrixArray, unsigned int numberOfMatrices)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix3fv. 更多…
void setUniformLocationWithMatrix4fv (GLint location, const GLfloat matrixArray, unsigned int numberOfMatrices)
仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix4fv. 更多…
void setUniformsForBuiltins ()
如果他们不同于前一个调用相同的着色器(shader),将会更新内键的制式. 更多…
void setUniformsForBuiltins (const Mat4 &modelView)
std::string getVertexShaderLog () const
返回vertexShader错误记录 更多…
std::string getFragmentShaderLog () const
返回fragmentShader错误记录 更多…
std::string getProgramLog () const
返回编程错误记录 更多…
void reset ()
const GLuint getProgram () const
CC_DEPRECATED_ATTRIBUTE bool initWithVertexShaderByteArray (const GLchar vertexByteArray, const GLchar fragByteArray)
CC_DEPRECATED_ATTRIBUTE bool initWithVertexShaderFilename (const std::string &vertexFilename, const std::string &fragFilename)
CC_DEPRECATED_ATTRIBUTE void addAttribute (const std::string &attributeName, GLuint index) const
bool updateUniformLocation (GLint location, const GLvoid data, unsigned int bytes)
virtual std::string getDescription () const
void bindPredefinedVertexAttribs ()
void parseVertexAttribs ()
void parseUniforms ()
bool compileShader (GLuint shader, GLenum type, const GLchar source)
std::string logForOpenGLObject (GLuint object, GLInfoFunction infoFunc, GLLogFunction logFunc) const
flag_struct ()
void CC_DLL invalidateStateCache (void)
使GL 的状态缓存作废. 更多…
void CC_DLL useProgram (GLuint program)
使用GL编程传人参数(in case)program不同于当前. 更多…
void CC_DLL deleteProgram (GLuint program)
删除 GL编程. 更多…
void CC_DLL blendFunc (GLenum sfactor, GLenum dfactor)
使用混合方法,传人参数(in case)是没有被使用的. 更多…
void CC_DLL blendResetToCache (void)
重设混合模式恢复缓存状态,假使你使用glBlendFuncSeparate() 或者 glBlendEquation()方法. 更多…
void CC_DLL setProjectionMatrixDirty (void)
设置投影矩阵暗淡(dirty) 更多…
void CC_DLL enableVertexAttribs (uint32_t flags)
将会使顶点属性像标记一样传递. 更多…
void CC_DLL bindTexture2D (GLuint textureId)
如果纹理(texture)没有绑定到纹理单位0,绑定它. 更多…
void CC_DLL bindTexture2DN (GLuint textureUnit, GLuint textureId)
如果纹理(texture)没有被绑定到指定的单位,绑定它. 更多…
void CC_DLL deleteTexture (GLuint textureId)
它将删除指定的textureId的纹理. 更多…
void CC_DLL deleteTextureN (GLuint textureUnit, GLuint textureId)
它将删除指定的textureId的纹理. 更多…
void CC_DLL activeTexture (GLenum texture)
选取活动的纹理单元(texture unit). 更多…
void CC_DLL bindVAO (GLuint vaoId)
如果顶点(vertex)数组没有绑定, 绑定它. 更多…
## 变量
GLuint index
GLint size
GLenum type
std::string name
GLint location
GLint size
GLenum type
std::string name
static const char SHADER_NAME_POSITION_TEXTURE_COLOR
static const char SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP
static const char SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST
static const char SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV
static const char SHADER_NAME_POSITION_COLOR
static const char SHADER_NAME_POSITION_COLOR_NO_MVP
static const char SHADER_NAME_POSITION_TEXTURE
static const char SHADER_NAME_POSITION_TEXTURE_U_COLOR
static const char SHADER_NAME_POSITION_TEXTURE_A8_COLOR
static const char SHADER_NAME_POSITION_U_COLOR
static const char SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR
static const char SHADER_NAME_LABEL_NORMAL
static const char SHADER_NAME_LABEL_OUTLINE
static const char SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL
static const char SHADER_NAME_LABEL_DISTANCEFIELD_GLOW
static const char UNIFORM_NAME_P_MATRIX
static const char UNIFORM_NAME_MV_MATRIX
static const char UNIFORM_NAME_MVP_MATRIX
static const char UNIFORM_NAME_TIME
static const char UNIFORM_NAME_SIN_TIME
static const char UNIFORM_NAME_COS_TIME
static const char UNIFORM_NAME_RANDOM01
static const char UNIFORM_NAME_SAMPLER0
static const char UNIFORM_NAME_SAMPLER1
static const char UNIFORM_NAME_SAMPLER2
static const char UNIFORM_NAME_SAMPLER3
static const char UNIFORM_NAME_ALPHA_TEST_VALUE
static const char ATTRIBUTE_NAME_COLOR
static const char ATTRIBUTE_NAME_POSITION
static const char ATTRIBUTE_NAME_TEX_COORD
static const char ATTRIBUTE_NAME_NORMAL
GLuint _program
GLuint _vertShader
GLuint _fragShader
GLint _builtInUniforms [UNIFORM_MAX]
struct _hashUniformEntry _hashForUniforms
bool _hasShaderCompiler
std::string _shaderId
unsigned int usesTime:1
unsigned int usesMVP:1
unsigned int usesMV:1
unsigned int usesP:1
unsigned int usesRandom:1
struct cocos2d::GLProgram::flag_struct _flags
std::unordered_map < std::string, Uniform > _userUniforms
std::unordered_map < std::string, VertexAttrib > _vertexAttribs
CC_DLL const GLchar ccPosition_uColor_frag
CC_DLL const GLchar ccPosition_uColor_vert
CC_DLL const GLchar ccPositionColor_frag
CC_DLL const GLchar ccPositionColor_vert
CC_DLL const GLchar ccPositionTexture_frag
CC_DLL const GLchar ccPositionTexture_vert
CC_DLL const GLchar ccPositionTextureA8Color_frag
CC_DLL const GLchar ccPositionTextureA8Color_vert
CC_DLL const GLchar ccPositionTextureColor_frag
CC_DLL const GLchar ccPositionTextureColor_vert
CC_DLL const GLchar ccPositionTextureColor_noMVP_frag
CC_DLL const GLchar ccPositionTextureColor_noMVP_vert
CC_DLL const GLchar ccPositionTextureColorAlphaTest_frag
CC_DLL const GLchar ccPositionTexture_uColor_frag
CC_DLL const GLchar ccPositionTexture_uColor_vert
CC_DLL const GLchar ccPositionColorLengthTexture_frag
CC_DLL const GLchar ccPositionColorLengthTexture_vert
CC_DLL const GLchar ccLabelDistanceFieldNormal_frag
CC_DLL const GLchar ccLabelDistanceFieldGlow_frag
CC_DLL const GLchar ccLabelNormal_frag
CC_DLL const GLchar ccLabelOutline_frag
CC_DLL const GLchar ccLabel_vert
## 友元
class GLProgramState

详细描述

类型定义说明

typedef void( GLInfoFunction)(GLuint program, GLenum pname, GLint params)

typedef void( GLLogFunction)(GLuint program, GLsizei bufsize, GLsizei length, GLchar *infolog)

枚举类型说明

anonymous enum
枚举值
VERTEX_ATTRIB_POSITION
VERTEX_ATTRIB_COLOR
VERTEX_ATTRIB_TEX_COORD
VERTEX_ATTRIB_NORMAL
VERTEX_ATTRIB_MAX
VERTEX_ATTRIB_TEX_COORDS

anonymous enum
枚举值
UNIFORM_P_MATRIX
UNIFORM_MV_MATRIX
UNIFORM_MVP_MATRIX
UNIFORM_TIME
UNIFORM_SIN_TIME
UNIFORM_COS_TIME
UNIFORM_RANDOM01
UNIFORM_SAMPLER0
UNIFORM_SAMPLER1
UNIFORM_SAMPLER2
UNIFORM_SAMPLER3
UNIFORM_MAX

anonymous enum

顶点(vertex)的属性标志

枚举值
VERTEX_ATTRIB_FLAG_NONE
VERTEX_ATTRIB_FLAG_POSITION
VERTEX_ATTRIB_FLAG_COLOR
VERTEX_ATTRIB_FLAG_TEX_COORD
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX

函数说明

flag_struct ( )

inline

GLProgram ( )

virtual ~GLProgram ( )

virtual

void CC_DLL cocos2d::GL::activeTexture ( GLenum texture)

选取活动的纹理单元(texture unit).

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将直接调用 glActiveTexture() 方法.

  • 自从
  • v3.0

CC_DEPRECATED_ATTRIBUTE void addAttribute ( const std::string & attributeName,
GLuint index
) const

inline

void bindAttribLocation ( const std::string & attributeName,
GLuint index
) const

通过调用glBindAttribLocation方法添加新的属性到着色器(shader)

void bindPredefinedVertexAttribs ( )

protected

void CC_DLL cocos2d::GL::bindTexture2D ( GLuint textureId)

如果纹理(texture)没有绑定到纹理单位0,绑定它.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将直接调用 glBindTexture()方法.

  • 自从
  • v2.0.0

void CC_DLL cocos2d::GL::bindTexture2DN ( GLuint textureUnit,
GLuint textureId
)

如果纹理(texture)没有被绑定到指定的单位,绑定它.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用,它将直接调用 glBindTexture() 方法.

  • 自从
  • v2.1.0

void CC_DLL cocos2d::GL::bindVAO ( GLuint vaoId)

如果顶点(vertex)数组没有绑定, 绑定它.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将直接调用 glBindVertexArray() 方法.

  • 自从
  • v2.0.0

void CC_DLL cocos2d::GL::blendFunc ( GLenum sfactor,
GLenum dfactor
)

使用混合方法,传人参数(in case)是没有被使用的.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它会直接执行 glBlendFunc()方法.

  • 自从
  • v2.0.0

void CC_DLL cocos2d::GL::blendResetToCache ( void )

重设混合模式恢复缓存状态,假使你使用glBlendFuncSeparate() 或者 glBlendEquation()方法.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将仅仅使用GL_FUNC_ADD设置默认混合模式.

  • 自从
  • v2.0.0

bool compileShader ( GLuint shader,
GLenum type,
const GLchar source
)

protected

static GLProgram createWithByteArrays ( const GLchar vShaderByteArray,
const GLchar * fShaderByteArray
)

static

使用顶点(vertex)和字节数组片段初始化GLProgram initWithString initWithString

static GLProgram* createWithFilenames ( const std::string & vShaderFilename,
const std::string & fShaderFilename
)

static

使用顶点(vertex)和文件名的内容片段初始化GLProgram init init

static GLProgram createWithPrecompiledProgramByteArray ( const GLchar vShaderByteArray,
const GLchar * fShaderByteArray
)

static

使用顶点(vertex)和片段字节数组初始化GLProgram initWithString initWithString

使用预编译着色器编程初始化CCGLProgram

void CC_DLL cocos2d::GL::deleteProgram ( GLuint program)

删除 GL编程.

如果program正在使用,该方法是program无效. 如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 他会直接执行 glDeleteProgram() 方法.

  • 自从
  • v2.0.0

void CC_DLL cocos2d::GL::deleteTexture ( GLuint textureId)

它将删除指定的textureId的纹理.

如果该纹理已经绑定,此方法会是它的缓存无效. 如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将直接调用glDeleteTextures()方法.

  • 自从
  • v2.0.0

void CC_DLL cocos2d::GL::deleteTextureN ( GLuint textureUnit,
GLuint textureId
)

它将删除指定的textureId的纹理.

如果该纹理已经绑定, 它将使缓存从给定的纹理单元失效. 如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它将直接调用 glDeleteTextures() 方法.

  • 自从
  • v2.1.0

void CC_DLL cocos2d::GL::enableVertexAttribs ( uint32_t flags)

将会使顶点属性像标记一样传递.

可能的标记(flags):

  1. VERTEX_ATTRIB_FLAG_POSITION
  2. VERTEX_ATTRIB_FLAG_COLOR
  3. VERTEX_ATTRIB_FLAG_TEX_COORDS

这些标记可以是ORed. 标记没有指定, 将会被禁用.

  • 自从
  • v2.0.0

GLint getAttribLocation ( const std::string & attributeName) const

调用 glGetAttribLocation方法

virtual std::string getDescription ( ) const

protectedvirtual

std::string getFragmentShaderLog ( ) const

返回fragmentShader错误记录

const GLuint getProgram ( ) const

inline

std::string getProgramLog ( ) const

返回编程错误记录

Uniform* getUniform ( const std::string & name)

GLint getUniformLocation ( const std::string & attributeName) const

调用 glGetUniformLocation()方法

GLint getUniformLocationForName ( const char * name) const

调用(retrieves)检索此着色器编程的指定名字制式的位置.

VertexAttrib* getVertexAttrib ( const std::string & name)

std::string getVertexShaderLog ( ) const

返回vertexShader错误记录

bool initWithByteArrays ( const GLchar vShaderByteArray,
const GLchar fShaderByteArray
)

bool initWithFilenames ( const std::string & vShaderFilename,
const std::string & fShaderFilename
)

bool initWithPrecompiledProgramByteArray ( const GLchar vShaderByteArray,
const GLchar fShaderByteArray
)

CC_DEPRECATED_ATTRIBUTE bool initWithVertexShaderByteArray ( const GLchar vertexByteArray,
const GLchar fragByteArray
)

inline

CC_DEPRECATED_ATTRIBUTE bool initWithVertexShaderFilename ( const std::string & vertexFilename,
const std::string & fragFilename
)

inline

void CC_DLL cocos2d::GL::invalidateStateCache ( void )

使GL 的状态缓存作废.

如果启用 CC_ENABLE_GL_STATE_CACHE 会重置 GL 状态缓存.

  • 自从
  • v2.0.0

bool link ( )

链接 glProgram

std::string logForOpenGLObject ( GLuint object,
GLInfoFunction infoFunc,
GLLogFunction logFunc
) const

protected

void parseUniforms ( )

protected

void parseVertexAttribs ( )

protected

void reset ( )

void CC_DLL cocos2d::GL::setProjectionMatrixDirty ( void )

设置投影矩阵暗淡(dirty)

  • 自从
  • v2.0.0

void setUniformLocationWith1f ( GLint location,
GLfloat f1
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform1f .

在 js 或 lua中, 请使用 setUniformLocationF32 NA

void setUniformLocationWith1i ( GLint location,
GLint i1
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform1i.

setUniformLocationI32 setUniformLocationI32

void setUniformLocationWith2f ( GLint location,
GLfloat f1,
GLfloat f2
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2f .

在 js 或 lua中, 请使用setUniformLocationF32 NA

void setUniformLocationWith2fv ( GLint location,
const GLfloat * floats,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2fv.

void setUniformLocationWith2i ( GLint location,
GLint i1,
GLint i2
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2i.

void setUniformLocationWith2iv ( GLint location,
GLint * ints,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform2iv.

void setUniformLocationWith3f ( GLint location,
GLfloat f1,
GLfloat f2,
GLfloat f3
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3f.

在 js 或 lua中, 请使用 setUniformLocationF32 NA

void setUniformLocationWith3fv ( GLint location,
const GLfloat * floats,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3fv.

void setUniformLocationWith3i ( GLint location,
GLint i1,
GLint i2,
GLint i3
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3i.

void setUniformLocationWith3iv ( GLint location,
GLint * ints,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform3iv.

void setUniformLocationWith4f ( GLint location,
GLfloat f1,
GLfloat f2,
GLfloat f3,
GLfloat f4
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4f.

I在 js 或 lua中, 请使用setUniformLocationF32 NA

void setUniformLocationWith4fv ( GLint location,
const GLfloat * floats,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4fv.

void setUniformLocationWith4i ( GLint location,
GLint i1,
GLint i2,
GLint i3,
GLint i4
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4i,仅仅当该值不同于前一个,相同的着色器(shader)编程才调.

void setUniformLocationWith4iv ( GLint location,
GLint * ints,
unsigned int numberOfArrays
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniform4iv.

void setUniformLocationWithMatrix2fv ( GLint location,
const GLfloat * matrixArray,
unsigned int numberOfMatrices
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix2fv.

void setUniformLocationWithMatrix3fv ( GLint location,
const GLfloat * matrixArray,
unsigned int numberOfMatrices
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix3fv.

void setUniformLocationWithMatrix4fv ( GLint location,
const GLfloat * matrixArray,
unsigned int numberOfMatrices
)

仅当该值不同于前一个调用相同的着色器(shader)编程,调用 glUniformMatrix4fv.

void setUniformsForBuiltins ( )

如果他们不同于前一个调用相同的着色器(shader),将会更新内键的制式.

void setUniformsForBuiltins ( const Mat4 & modelView)

bool updateUniformLocation ( GLint location,
const GLvoid * data,
unsigned int bytes
)

protected

void updateUniforms ( )

它将创建4种制式(uniforms):

  • kUniformPMatrix
  • kUniformMVMatrix
  • kUniformMVPMatrix
  • GLProgram::UNIFORM_SAMPLER

且会绑定"GLProgram::UNIFORM_SAMPLER" 到0

void use ( )

它将调用glUseProgram()方法

void CC_DLL cocos2d::GL::useProgram ( GLuint program)

使用GL编程传人参数(in case)program不同于当前.

如果 CC_ENABLE_GL_STATE_CACHE 被禁用, 它会直接使用 glUseProgram()方法.

  • 自从
  • v2.0.0

变量说明

GLint _builtInUniforms[UNIFORM_MAX]

protected

struct cocos2d::GLProgram::flag_struct _flags

protected

GLuint _fragShader

protected

struct _hashUniformEntry* _hashForUniforms

protected

bool _hasShaderCompiler

protected

GLuint _program

protected

std::string _shaderId

protected

std::unordered_map<std::string, Uniform> _userUniforms

protected

std::unordered_map<std::string, VertexAttrib> _vertexAttribs

protected

GLuint _vertShader

protected

const char* ATTRIBUTE_NAME_COLOR

static

const char* ATTRIBUTE_NAME_NORMAL

static

const char* ATTRIBUTE_NAME_POSITION

static

const char* ATTRIBUTE_NAME_TEX_COORD

static

CC_DLL const GLchar* ccLabel_vert

CC_DLL const GLchar* ccLabelDistanceFieldGlow_frag

CC_DLL const GLchar* ccLabelDistanceFieldNormal_frag

CC_DLL const GLchar* ccLabelNormal_frag

CC_DLL const GLchar* ccLabelOutline_frag

CC_DLL const GLchar* ccPosition_uColor_frag

CC_DLL const GLchar* ccPosition_uColor_vert

CC_DLL const GLchar* ccPositionColor_frag

CC_DLL const GLchar* ccPositionColor_vert

CC_DLL const GLchar* ccPositionColorLengthTexture_frag

CC_DLL const GLchar* ccPositionColorLengthTexture_vert

CC_DLL const GLchar* ccPositionTexture_frag

CC_DLL const GLchar* ccPositionTexture_uColor_frag

CC_DLL const GLchar* ccPositionTexture_uColor_vert

CC_DLL const GLchar* ccPositionTexture_vert

CC_DLL const GLchar* ccPositionTextureA8Color_frag

CC_DLL const GLchar* ccPositionTextureA8Color_vert

CC_DLL const GLchar* ccPositionTextureColor_frag

CC_DLL const GLchar* ccPositionTextureColor_noMVP_frag

CC_DLL const GLchar* ccPositionTextureColor_noMVP_vert

CC_DLL const GLchar* ccPositionTextureColor_vert

CC_DLL const GLchar* ccPositionTextureColorAlphaTest_frag

GLuint index

GLint location

std::string name

std::string name

const char* SHADER_NAME_LABEL_DISTANCEFIELD_GLOW

static

const char* SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL

static

const char* SHADER_NAME_LABEL_NORMAL

static

const char* SHADER_NAME_LABEL_OUTLINE

static

const char* SHADER_NAME_POSITION_COLOR

static

const char* SHADER_NAME_POSITION_COLOR_NO_MVP

static

const char* SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR

static

const char* SHADER_NAME_POSITION_TEXTURE

static

const char* SHADER_NAME_POSITION_TEXTURE_A8_COLOR

static

const char* SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST

static

const char* SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV

static

const char* SHADER_NAME_POSITION_TEXTURE_COLOR

static

const char* SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP

static

const char* SHADER_NAME_POSITION_TEXTURE_U_COLOR

static

const char* SHADER_NAME_POSITION_U_COLOR

static

GLint size

GLint size

GLenum type

GLenum type

const char* UNIFORM_NAME_ALPHA_TEST_VALUE

static

const char* UNIFORM_NAME_COS_TIME

static

const char* UNIFORM_NAME_MV_MATRIX

static

const char* UNIFORM_NAME_MVP_MATRIX

static

const char* UNIFORM_NAME_P_MATRIX

static

const char* UNIFORM_NAME_RANDOM01

static

const char* UNIFORM_NAME_SAMPLER0

static

const char* UNIFORM_NAME_SAMPLER1

static

const char* UNIFORM_NAME_SAMPLER2

static

const char* UNIFORM_NAME_SAMPLER3

static

const char* UNIFORM_NAME_SIN_TIME

static

const char* UNIFORM_NAME_TIME

static

unsigned int usesMV

unsigned int usesMVP

unsigned int usesP

unsigned int usesRandom

unsigned int usesTime

友元

friend class GLProgramState

friend

  • 生成于 2014年 五月 29日 星期四 09:41:42 , 为 cocos2d-x使用 doxygen 1.8.6