summaryrefslogtreecommitdiffstats
path: root/jni_mosaic/feature_mos/src/mosaic_renderer/FrameBuffer.h
blob: 314b1262285c5064d801bcc1fecb8c617e67149c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#define checkGlError(op)  checkGLErrorDetail(__FILE__, __LINE__, (op))

extern bool checkGLErrorDetail(const char* file, int line, const char* op);
extern void checkFramebufferStatus(const char* name);

class FrameBuffer {
  public:
    FrameBuffer();
    virtual ~FrameBuffer();

    bool InitializeGLContext();
    bool Init(int width, int height, GLenum format);
    GLuint GetTextureName() const;
    GLuint GetFrameBufferName() const;
    GLenum GetFormat() const;

    int GetWidth() const;
    int GetHeight() const;

 private:
    void Reset();
    bool CreateBuffers();
    GLuint mFrameBufferName;
    GLuint mTextureName;
    int mWidth;
    int mHeight;
    GLenum mFormat;
};