1 #pragma once 2 3 #include <EGL/egl.h> 4 #include <GLES2/gl2.h> 5 #include <GLES2/gl2ext.h> 6 7 extern bool checkGlError(const char* op); 8 9 class FrameBuffer { 10 public: 11 FrameBuffer(); 12 virtual ~FrameBuffer(); 13 14 bool InitializeGLContext(); 15 bool Init(int width, int height, GLenum format); 16 GLuint GetTextureName() const; 17 GLuint GetFrameBufferName() const; 18 GLenum GetFormat() const; 19 20 int GetWidth() const; 21 int GetHeight() const; 22 23 private: 24 void Reset(); 25 bool CreateBuffers(); 26 GLuint mFrameBufferName; 27 GLuint mTextureName; 28 int mWidth; 29 int mHeight; 30 GLenum mFormat; 31 }; 32