cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.koboldtouch.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
ccGLStateCache.h File Reference
#import <TargetConditionals.h>
#import "ccMacros.h"
#import "Platforms/CCGL.h"
Include dependency graph for ccGLStateCache.h:

Enumerations

enum  {
  kCCVertexAttribFlag_None = 0, kCCVertexAttribFlag_Position = 1 << 0, kCCVertexAttribFlag_Color = 1 << 1, kCCVertexAttribFlag_TexCoords = 1 << 2,
  kCCVertexAttribFlag_PosColorTex = (kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color | kCCVertexAttribFlag_TexCoords)
}
 
enum  ccGLServerState { CC_GL_ALL = 0 }
 

Functions

void ccGLInvalidateStateCache (void)
 
void ccGLUseProgram (GLuint program)
 
void ccGLDeleteProgram (GLuint program)
 
void ccGLBlendFunc (GLenum sfactor, GLenum dfactor)
 
void ccGLBlendResetToCache (void)
 
void ccSetProjectionMatrixDirty (void)
 
void ccGLEnableVertexAttribs (unsigned int flags)
 
void ccGLBindTexture (GLenum target, GLuint textureId)
 
void ccGLBindTexture2D (GLuint textureId)
 
void ccGLBindTexture2DN (GLuint textureUnit, GLuint textureId)
 
void ccGLDeleteTexture (GLuint textureId)
 
void ccGLDeleteTextureN (GLuint textureUnit, GLuint textureId)
 
void ccGLBindVAO (GLuint vaoId)
 
void ccGLEnable (ccGLServerState flags)
 

Enumeration Type Documentation

anonymous enum

vertex attrib flags

GL server side states

Function Documentation

void ccGLBindTexture ( GLenum  target,
GLuint  textureId 
)

If the texture is not already bound to texture unit 0 and if target is GL_TEXTURE_2D, it binds it. If CC_ENABLE_GL_STATE_CACHE is disabled or if target != GL_TEXTURE_2D it will call glBindTexture() directly.

Since
v2.1
void ccGLBindTexture2D ( 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
void ccGLBindTexture2DN ( 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
void ccGLBindVAO ( 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
void ccGLBlendFunc ( 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
void ccGLBlendResetToCache ( 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
void ccGLDeleteProgram ( 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
void ccGLDeleteTexture ( GLuint  textureId)

It will delete a given texture. If the texture was bound, it will invalidate the cached for texture unit 0. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.

Since
v2.0.0
void ccGLDeleteTextureN ( 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
void ccGLEnable ( ccGLServerState  flags)

It will enable / disable the server side GL states. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glEnable() directly.

Since
v2.0.0
void ccGLEnableVertexAttribs ( unsigned int  flags)

Will enable the vertex attribs that are passed as flags. Possible flags:

kCCVertexAttribFlag_Position kCCVertexAttribFlag_Color kCCVertexAttribFlag_TexCoords

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

Since
v2.0.0
void ccGLInvalidateStateCache ( void  )

Invalidates the GL state cache. If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.

Since
v2.0.0
void ccGLUseProgram ( 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
void ccSetProjectionMatrixDirty ( void  )

sets the projection matrix as dirty

Since
v2.0.0