inventory render optimized

This commit is contained in:
MihailRis
2024-01-21 23:35:41 +03:00
parent 714a49685f
commit db2108171c
12 changed files with 285 additions and 255 deletions
+4 -2
View File
@@ -3,13 +3,15 @@
#include <GL/glew.h>
#include "Texture.h"
Framebuffer::Framebuffer(uint width, uint height) : width(width), height(height) {
Framebuffer::Framebuffer(uint width, uint height, bool alpha)
: width(width), height(height) {
glGenFramebuffers(1, &fbo);
bind();
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
GLuint format = alpha ? GL_RGBA : GL_RGB;
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);