frame buffers

main
Brett 2024-04-16 16:07:54 -04:00
parent 478cba5e15
commit 3a45b25cfe
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(graphs VERSION 0.0.9) project(graphs VERSION 0.0.10)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)

@ -1 +1 @@
Subproject commit cd7c34cb1616b8496acbf69042f0ab92cfbfca83 Subproject commit e9e36229633164c1133915c4fe73469fae6b65ab

View File

@ -19,28 +19,34 @@
#include "blt/gfx/renderer/resource_manager.h" #include "blt/gfx/renderer/resource_manager.h"
#include "blt/gfx/renderer/batch_2d_renderer.h" #include "blt/gfx/renderer/batch_2d_renderer.h"
#include "blt/gfx/renderer/camera.h" #include "blt/gfx/renderer/camera.h"
#include <blt/gfx/framebuffer.h>
#include <imgui.h> #include <imgui.h>
blt::gfx::matrix_state_manager global_matrices; blt::gfx::matrix_state_manager global_matrices;
blt::gfx::resource_manager resources; blt::gfx::resource_manager resources;
blt::gfx::batch_renderer_2d renderer_2d(resources); blt::gfx::batch_renderer_2d renderer_2d(resources);
blt::gfx::first_person_camera camera; blt::gfx::first_person_camera camera;
blt::gfx::fbo_t render_texture;
void init(blt::gfx::window_context& context) void init(const blt::gfx::window_context& context)
{ {
using namespace blt::gfx; using namespace blt::gfx;
global_matrices.create_internals(); global_matrices.create_internals();
resources.load_resources(); resources.load_resources();
renderer_2d.create(); renderer_2d.create();
render_texture = fbo_t::make_render_texture(1440, 720);
} }
float x = 50, y = 50; float x = 50, y = 50;
float sx = 0.5, sy = 0.5; float sx = 0.5, sy = 0.5;
float ax = 0.05, ay = 0.05; float ax = 0.05, ay = 0.05;
void update(blt::gfx::window_context& context, std::int32_t width, std::int32_t height) void update(const blt::gfx::window_context& context, std::int32_t width, std::int32_t height)
{ {
render_texture.bind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
global_matrices.update_perspectives(width, height, 90, 0.1, 2000); global_matrices.update_perspectives(width, height, 90, 0.1, 2000);
x += sx; x += sx;
@ -65,6 +71,7 @@ void update(blt::gfx::window_context& context, std::int32_t width, std::int32_t
global_matrices.update(); global_matrices.update();
renderer_2d.render(); renderer_2d.render();
blt::gfx::fbo_t::unbind();
} }
int main(int argc, const char** argv) int main(int argc, const char** argv)