2018-06-16 21:31:29 +00:00
|
|
|
#ifndef FBO_H
|
|
|
|
#define FBO_H
|
|
|
|
|
2020-07-31 19:18:51 +00:00
|
|
|
#include <GL/glew.h>
|
2018-06-16 21:31:29 +00:00
|
|
|
#include "VBO.h"
|
|
|
|
#include "GLSLShader.h"
|
|
|
|
#include "Model.h"
|
|
|
|
|
|
|
|
namespace New3D {
|
|
|
|
|
|
|
|
class R3DFrameBuffers {
|
|
|
|
|
|
|
|
public:
|
|
|
|
R3DFrameBuffers();
|
|
|
|
~R3DFrameBuffers();
|
|
|
|
|
2019-01-21 14:30:42 +00:00
|
|
|
void Draw(); // draw and composite the transparent layers
|
|
|
|
|
2018-06-16 21:31:29 +00:00
|
|
|
bool CreateFBO(int width, int height);
|
|
|
|
void DestroyFBO();
|
|
|
|
|
|
|
|
void BindTexture(Layer layer);
|
|
|
|
void SetFBO(Layer layer);
|
|
|
|
void StoreDepth();
|
|
|
|
void RestoreDepth();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
bool CreateFBODepthCopy(int width, int height);
|
|
|
|
GLuint CreateTexture(int width, int height);
|
|
|
|
void AllocShaderTrans();
|
|
|
|
void AllocShaderBase();
|
|
|
|
|
|
|
|
void DrawBaseLayer();
|
|
|
|
void DrawAlphaLayer();
|
|
|
|
|
|
|
|
GLuint m_frameBufferID;
|
|
|
|
GLuint m_renderBufferID;
|
|
|
|
GLuint m_texIDs[3];
|
|
|
|
GLuint m_frameBufferIDCopy;
|
|
|
|
GLuint m_renderBufferIDCopy;
|
|
|
|
Layer m_lastLayer;
|
|
|
|
int m_width;
|
|
|
|
int m_height;
|
|
|
|
|
|
|
|
// shaders
|
|
|
|
GLSLShader m_shaderBase;
|
|
|
|
GLSLShader m_shaderTrans;
|
|
|
|
|
2022-11-07 21:33:01 +00:00
|
|
|
// vao
|
|
|
|
GLuint m_vao; // this really needed if we don't actually use vertex attribs?
|
2018-06-16 21:31:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-08-19 19:34:22 +00:00
|
|
|
#endif
|