feat: add OpenGL abstraction layer with RAII resources

- Replace window class with cbt::opengl::context
- Add buffer resource (VBO, EBO, UBO, SSBO) with move semantics
- Add texture resource with format/type enums and filtering
- Add descriptor_set for Vulkan-style resource binding
- All resources use RAII with proper cleanup
This commit is contained in:
2026-05-05 21:58:34 +02:00
parent f18e5e4adc
commit 90d013695d
36 changed files with 2139 additions and 55 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "cbt/window.hpp"
#include "cbt/opengl/context.hpp"
#include <csignal>
@@ -10,9 +10,9 @@
#include "glad/glad.h"
auto main(int, char const*[]) -> int {
auto w = cbt::window("cuber", 1280, 720);
auto ctx = cbt::opengl::context("cuber", 1280, 720);
if (!w.valid()) {
if (!ctx.valid()) {
return 1;
}
@@ -29,18 +29,18 @@ auto main(int, char const*[]) -> int {
while (io.poll()) {}
};
while (!w.should_close()) {
while (!ctx.should_close()) {
process_signals();
if (quit || glfwGetKey(static_cast<GLFWwindow*>(w.raw()), GLFW_KEY_Q) == GLFW_PRESS) {
if (quit || glfwGetKey(ctx.raw(), GLFW_KEY_Q) == GLFW_PRESS) {
break;
}
glClearColor(0.6f, 0.8f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
w.swap_buffers();
w.poll_events();
ctx.swap_buffers();
ctx.poll_events();
}
return 0;