cocos2d-iphone  2.0
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
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_BLEND = 1 << 3, CC_GL_ALL = ( CC_GL_BLEND ) }

Functions

void ccGLInvalidateStateCache (void)
void ccGLUseProgram (GLuint program)
void ccGLDeleteProgram (GLuint program)
void ccGLBlendFunc (GLenum sfactor, GLenum dfactor)
void ccSetProjectionMatrixDirty (void)
void ccGLEnableVertexAttribs (unsigned int flags)
void ccGLActiveTexture (GLenum textureEnum)
GLenum ccGLGetActiveTexture (void)
void ccGLBindTexture2D (GLuint textureId)
void ccGLDeleteTexture (GLuint textureId)
void ccGLEnable (ccGLServerState flags)

Detailed Description


Enumeration Type Documentation

anonymous enum

vertex attrib flags

GL server side states


Function Documentation

void ccGLActiveTexture ( GLenum  textureEnum)

If the active texture is not textureEnum, then it will active it. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.

Since:
v2.0.0
void ccGLBindTexture2D ( GLuint  textureId)

If the texture is not already bound, it binds it. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() 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 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. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.

Since:
v2.0.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
GLenum ccGLGetActiveTexture ( void  )

Returns the active texture. If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glGetIntegerv(GL_ACTIVE_TEXTURE);

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