GLShader.h 786 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1 2 3
#import <GLKit/GLKit.h>
#import "RCTBridgeModule.h"

4 5 6
NS_ENUM(NSInteger) {
    GLContextFailure = 87001,
    GLLinkingFailure = 87002,
7 8
    GLCompileFailure = 87003,
    GLNotAProgram    = 87004
9 10
};

Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
11 12
@interface GLShader: NSObject

13
@property NSString *name;
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
14 15 16 17 18 19 20 21
@property EAGLContext *context;
@property NSString *vert;
@property NSString *frag;
@property NSDictionary *uniformTypes;

/**
 * Create a new shader with a vertex and fragment
 */
22
- (instancetype)initWithContext: (EAGLContext*)context withName:(NSString *)name withVert:(NSString *)vert withFrag:(NSString *)frag;
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
23 24 25 26 27 28

/**
 * Bind the shader program as the current one
 */
- (void) bind;

29
- (bool) ensureCompiles: (NSError**)error;
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
30 31 32 33 34 35 36

/**
 * Set the value of an uniform
 */
- (void) setUniform: (NSString *)name withValue:(id)obj;

@end