Cocos2d-x  v3.15
Renderer

Namespaces

 cocos2d
 Copyright 2013 BlackBerry Inc.
 

Enumerations

enum  
 Vertex attrib flags. More...
 

Functions

void invalidateStateCache (void)
 Invalidates the GL state cache. More...
 
void useProgram (GLuint program)
 Uses the GL program in case program is different than the current one. More...
 
void deleteProgram (GLuint program)
 Deletes the GL program. More...
 
void blendFunc (GLenum sfactor, GLenum dfactor)
 Uses a blending function in case it not already used. More...
 
void blendResetToCache (void)
 Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation(). More...
 
void setProjectionMatrixDirty (void)
 Sets the projection matrix as dirty. More...
 
void enableVertexAttribs (uint32_t flags)
 Will enable the vertex attribs that are passed as flags. More...
 
void bindTexture2D (GLuint textureId)
 If the texture is not already bound to texture unit 0, it binds it. More...
 
void bindTexture2D (Texture2D *texture)
 If the texture is not already bound to texture unit 0, it binds it. More...
 
void bindTexture2DN (GLuint textureUnit, GLuint textureId)
 If the texture is not already bound to a given unit, it binds it. More...
 
void bindTextureN (GLuint textureUnit, GLuint textureId, GLuint textureType=GL_TEXTURE_2D)
 If the texture is not already bound to a given unit, it binds it. More...
 
void deleteTexture (GLuint textureId)
 It will delete a given texture. More...
 
void deleteTextureN (GLuint textureUnit, GLuint textureId)
 It will delete a given texture. More...
 
void activeTexture (GLenum texture)
 Select active texture unit. More...
 
void bindVAO (GLuint vaoId)
 If the vertex array is not already bound, it binds it. More...
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Vertex attrib flags.

Function Documentation

◆ invalidateStateCache()

void cocos2d::GL::invalidateStateCache ( void  )

Invalidates the GL state cache.

If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.

Since
v2.0.0

◆ useProgram()

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

Uses the GL program in case program is different than the current one.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.

Since
v2.0.0

◆ deleteProgram()

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

Deletes the GL program.

If it is the one that is being used, it invalidates it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.

Since
v2.0.0

◆ blendFunc()

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

Uses a blending function in case it not already used.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.

Since
v2.0.0

◆ blendResetToCache()

void cocos2d::GL::blendResetToCache ( void  )

Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().

If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.

Since
v2.0.0

◆ setProjectionMatrixDirty()

void cocos2d::GL::setProjectionMatrixDirty ( void  )

Sets the projection matrix as dirty.

Since
v2.0.0

◆ enableVertexAttribs()

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

Will enable the vertex attribs that are passed as flags.

Possible flags:

  • VERTEX_ATTRIB_FLAG_POSITION
  • VERTEX_ATTRIB_FLAG_COLOR
  • VERTEX_ATTRIB_FLAG_TEX_COORDS

These flags can be ORed. The flags that are not present, will be disabled.

Since
v2.0.0

◆ bindTexture2D() [1/2]

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

If the texture is not already bound to texture unit 0, it binds it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.

Since
v2.0.0

◆ bindTexture2D() [2/2]

void cocos2d::GL::bindTexture2D ( Texture2D texture)

If the texture is not already bound to texture unit 0, it binds it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.

Remarks
: It will bind alpha texture to support ETC1 alpha channel.
Since
v3.13

◆ bindTexture2DN()

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

If the texture is not already bound to a given unit, it binds it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.

Since
v2.1.0

◆ bindTextureN()

void cocos2d::GL::bindTextureN ( GLuint  textureUnit,
GLuint  textureId,
GLuint  textureType = GL_TEXTURE_2D 
)

If the texture is not already bound to a given unit, it binds it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.

Since
v3.6

◆ deleteTexture()

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

It will delete a given texture.

If the texture was bound, it will invalidate the cached.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.

Since
v2.0.0

◆ deleteTextureN()

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

It will delete a given texture.

If the texture was bound, it will invalidate the cached for the given texture unit.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.

Since
v2.1.0

◆ activeTexture()

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

Select active texture unit.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.

Since
v3.0

◆ bindVAO()

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

If the vertex array is not already bound, it binds it.

If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.

Since
v2.0.0