#import #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #import #import #import #else #import #import #endif #import #import typedef struct GPUTextureOptions { GLenum minFilter; GLenum magFilter; GLenum wrapS; GLenum wrapT; GLenum internalFormat; GLenum format; GLenum type; } GPUTextureOptions; @interface GPUImageFramebuffer : NSObject @property (nonatomic, readonly) CGSize size; @property (nonatomic, readonly) GPUTextureOptions textureOptions; @property (nonatomic, readonly) GLuint texture; @property (nonatomic, readonly) BOOL missingFramebuffer; // Initialization and teardown - (id)initWithSize:(CGSize)framebufferSize; - (id)initWithSize:(CGSize)framebufferSize textureOptions:(GPUTextureOptions)fboTextureOptions onlyTexture:(BOOL)onlyGenerateTexture; - (id)initWithSize:(CGSize)framebufferSize overriddenTexture:(GLuint)inputTexture; // Usage - (void)activateFramebuffer; // Reference counting - (void)lock; - (void)unlock; - (void)clearAllLocks; - (void)disableReferenceCounting; - (void)enableReferenceCounting; // Image capture - (CGImageRef)newCGImageFromFramebufferContents; - (void)restoreRenderTarget; // Raw data bytes - (void)lockForReading; - (void)unlockAfterReading; - (NSUInteger)bytesPerRow; - (GLubyte *)byteBuffer; @end