Files
cuber/cuber.cpp
T
portersky 90d013695d 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
2026-05-05 21:58:34 +02:00

48 lines
893 B
C++

#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "cbt/opengl/context.hpp"
#include <csignal>
#include <asio.hpp>
#include "glad/glad.h"
auto main(int, char const*[]) -> int {
auto ctx = cbt::opengl::context("cuber", 1280, 720);
if (!ctx.valid()) {
return 1;
}
asio::io_context io;
asio::signal_set signals(io, SIGINT, SIGTERM);
bool quit = false;
signals.async_wait([&](auto, auto) {
quit = true;
io.stop();
});
auto process_signals = [&]() -> void {
while (io.poll()) {}
};
while (!ctx.should_close()) {
process_signals();
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);
ctx.swap_buffers();
ctx.poll_events();
}
return 0;
}