Files
anm2ed/src/framebuffer.h
T
shweet 7afdf709c3 Format like smack-a-brother, and write comments as sentences
Four-space indents, braces on their own lines, and one-statement bodies without braces.
Semicolons in comments became full stops.
Designated initializers may leave fields out without a warning.
2026-11-22 17:30:03 -05:00

36 lines
735 B
C++

#pragma once
#include <glad/glad.h>
#include <glm/glm.hpp>
class Framebuffer
{
public:
enum class Type
{
UNDERLAY,
LAYER,
OVERLAY,
};
GLuint fbo = 0;
GLuint rbo = 0;
GLuint texture = 0;
glm::vec2 size{};
glm::vec2 previousSize{};
GLint filter = GL_LINEAR; // how the texture is sampled when drawn scaled. Takes effect on the next resize
Framebuffer();
~Framebuffer();
void set();
void resize_check();
void size_set(glm::vec2);
void viewport_set() const;
void clear(glm::vec4 = glm::vec4(1.0f, 1.0f, 1.0f, 0.0f)) const;
std::vector<uint8_t> pixels_get() const;
bool is_valid() const;
void bind() const;
void unbind() const;
};