ppdnode/lib/FrameBuffer.h

39 lines
687 B
C++

// FrameBuffer.h
#ifdef __EMSCRIPTEN__
#else
#include "GL/glew.h"
#endif
#pragma once
#include <iostream>
#if defined(__APPLE__)
#include <SDL2/SDL.h>
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <SDL2/SDL_opengles.h>
#else
#include <SDL2/SDL_opengl.h>
#endif
#else
#include <SDL.h>
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <SDL_opengles2.h>
#else
#include <SDL_opengl.h>
#endif
#endif
class FrameBuffer {
public:
FrameBuffer(float width, float height);
~FrameBuffer();
unsigned int getFrameTexture();
void RescaleFrameBuffer(float width, float height);
void Bind() const;
void Unbind() const;
private:
unsigned int fbo;
unsigned int texture;
unsigned int rbo;
};