cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
CCGLProgram Class Reference

#import <CCGLProgram.h>

Inheritance diagram for CCGLProgram:
Collaboration diagram for CCGLProgram:

Instance Methods

(id) - initWithVertexShaderByteArray:fragmentShaderByteArray:
 
(id) - initWithVertexShaderFilename:fragmentShaderFilename:
 
(void) - addAttribute:index:
 
(BOOL) - link
 
(void) - use
 
(void) - updateUniforms
 
(void) - setUniformLocation:withI1:
 
(void) - setUniformLocation:withF1:
 
(void) - setUniformLocation:withF1:f2:
 
(void) - setUniformLocation:withF1:f2:f3:
 
(void) - setUniformLocation:withF1:f2:f3:f4:
 
(void) - setUniformLocation:with2fv:count:
 
(void) - setUniformLocation:with3fv:count:
 
(void) - setUniformLocation:with4fv:count:
 
(void) - setUniformLocation:withMatrix4fv:count:
 
(void) - setUniformsForBuiltins
 
((__deprecated__) - __attribute__
 
(NSString *) - vertexShaderLog
 
(NSString *) - fragmentShaderLog
 
(NSString *) - programLog
 

Public Attributes

GLuint program_
 
GLuint vertShader_
 
GLuint fragShader_
 
GLint uniforms_ [kCCUniform_MAX]
 
BOOL usesTime_
 

Protected Attributes

struct _hashUniformEntry * hashForUniforms_
 

Properties

GLuint program
 

Detailed Description

CCGLProgram Class that implements a glProgram

Since
v2.0.0

Method Documentation

- ((__deprecated__) __attribute__

Deprecated alias for setUniformsForBuiltins

- (void) addAttribute: (NSString *)  attributeName
index: (GLuint)  index 

It will add a new attribute to the shader

- (NSString *) fragmentShaderLog

returns the fragmentShader error log

- (id) initWithVertexShaderByteArray: (const GLchar *)  vShaderByteArray
fragmentShaderByteArray: (const GLchar *)  fShaderByteArray 

Initializes the CCGLProgram with a vertex and fragment with bytes array

- (id) initWithVertexShaderFilename: (NSString *)  vShaderFilename
fragmentShaderFilename: (NSString *)  fShaderFilename 

Initializes the CCGLProgram with a vertex and fragment with contents of filenames

- (BOOL) link

links the glProgram

- (NSString *) programLog

returns the program error log

- (void) setUniformLocation: (GLint)  location
with2fv: (GLfloat *)  floats
count: (NSUInteger)  numberOfArrays 

calls glUniform2fv only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
with3fv: (GLfloat *)  floats
count: (NSUInteger)  numberOfArrays 

calls glUniform3fv only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
with4fv: (GLvoid *)  floats
count: (NSUInteger)  numberOfArrays 

calls glUniform4fv only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withF1: (GLfloat)  f1 

calls glUniform1f only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withF1: (GLfloat)  f1
f2: (GLfloat)  f2 

calls glUniform2f only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withF1: (GLfloat)  f1
f2: (GLfloat)  f2
f3: (GLfloat)  f3 

calls glUniform3f only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withF1: (GLfloat)  f1
f2: (GLfloat)  f2
f3: (GLfloat)  f3
f4: (GLfloat)  f4 

calls glUniform4f only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withI1: (GLint)  i1 

calls glUniform1i only if the values are different than the previous call for this same shader program.

- (void) setUniformLocation: (GLint)  location
withMatrix4fv: (GLvoid *)  matrix_array
count: (NSUInteger)  numberOfMatrix 

calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program.

- (void) setUniformsForBuiltins

will update the builtin uniforms if they are different than the previous call for this same shader program.

- (void) updateUniforms

It will create 4 uniforms:

  • kCCUniformPMatrix
  • kCCUniformMVMatrix
  • kCCUniformMVPMatrix
  • kCCUniformSampler

And it will bind "kCCUniformSampler" to 0

- (void) use

it will call glUseProgram()

- (NSString *) vertexShaderLog

returns the vertexShader error log


The documentation for this class was generated from the following file: