// This is Jeff LaMarche's GLProgram OpenGL shader wrapper class from his OpenGL ES 2.0 book. // A description of this can be found at his page on the topic: // http://iphonedevelopment.blogspot.com/2010/11/opengl-es-20-for-ios-chapter-4.html // I've extended this to be able to take programs as NSStrings in addition to files, for baked-in shaders #import #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #import #import #else #import #import #endif @interface GLProgram : NSObject { NSMutableArray *attributes; NSMutableArray *uniforms; GLuint program, vertShader, fragShader; } @property(readwrite, nonatomic) BOOL initialized; - (id)initWithVertexShaderString:(NSString *)vShaderString fragmentShaderString:(NSString *)fShaderString; - (id)initWithVertexShaderString:(NSString *)vShaderString fragmentShaderFilename:(NSString *)fShaderFilename; - (id)initWithVertexShaderFilename:(NSString *)vShaderFilename fragmentShaderFilename:(NSString *)fShaderFilename; - (void)addAttribute:(NSString *)attributeName; - (GLuint)attributeIndex:(NSString *)attributeName; - (GLuint)uniformIndex:(NSString *)uniformName; - (BOOL)link; - (void)use; - (NSString *)vertexShaderLog; - (NSString *)fragmentShaderLog; - (NSString *)programLog; - (void)validate; @end