GPUImageFramebuffer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #import <Foundation/Foundation.h>
  2. #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
  3. #import <OpenGLES/EAGL.h>
  4. #import <OpenGLES/ES2/gl.h>
  5. #import <OpenGLES/ES2/glext.h>
  6. #else
  7. #import <OpenGL/OpenGL.h>
  8. #import <OpenGL/gl.h>
  9. #endif
  10. #import <QuartzCore/QuartzCore.h>
  11. #import <CoreMedia/CoreMedia.h>
  12. typedef struct GPUTextureOptions {
  13. GLenum minFilter;
  14. GLenum magFilter;
  15. GLenum wrapS;
  16. GLenum wrapT;
  17. GLenum internalFormat;
  18. GLenum format;
  19. GLenum type;
  20. } GPUTextureOptions;
  21. @interface GPUImageFramebuffer : NSObject
  22. @property(readonly) CGSize size;
  23. @property(readonly) GPUTextureOptions textureOptions;
  24. @property(readonly) GLuint texture;
  25. @property(readonly) BOOL missingFramebuffer;
  26. // Initialization and teardown
  27. - (id)initWithSize:(CGSize)framebufferSize;
  28. - (id)initWithSize:(CGSize)framebufferSize textureOptions:(GPUTextureOptions)fboTextureOptions onlyTexture:(BOOL)onlyGenerateTexture;
  29. - (id)initWithSize:(CGSize)framebufferSize overriddenTexture:(GLuint)inputTexture;
  30. // Usage
  31. - (void)activateFramebuffer;
  32. // Reference counting
  33. - (void)lock;
  34. - (void)unlock;
  35. - (void)clearAllLocks;
  36. - (void)disableReferenceCounting;
  37. - (void)enableReferenceCounting;
  38. // Image capture
  39. - (CGImageRef)newCGImageFromFramebufferContents;
  40. - (void)restoreRenderTarget;
  41. // Raw data bytes
  42. - (void)lockForReading;
  43. - (void)unlockAfterReading;
  44. - (NSUInteger)bytesPerRow;
  45. - (GLubyte *)byteBuffer;
  46. @end