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