mirror of
https://github.com/danog/Telegram.git
synced 2024-12-11 17:09:46 +01:00
43 lines
1.4 KiB
Objective-C
Executable File
43 lines
1.4 KiB
Objective-C
Executable File
// 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 <Foundation/Foundation.h>
|
|
|
|
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
|
|
#import <OpenGLES/ES2/gl.h>
|
|
#import <OpenGLES/ES2/glext.h>
|
|
#else
|
|
#import <OpenGL/OpenGL.h>
|
|
#import <OpenGL/gl.h>
|
|
#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
|