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:
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "cbt/opengl/buffer.hpp"
|
||||
#include "cbt/opengl/texture.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace cbt::opengl {
|
||||
|
||||
struct descriptor_binding {
|
||||
GLuint texture_unit = 0;
|
||||
std::optional<texture> tex;
|
||||
std::optional<buffer> buf;
|
||||
};
|
||||
|
||||
class descriptor_set {
|
||||
std::vector<descriptor_binding> m_bindings;
|
||||
|
||||
public:
|
||||
descriptor_set();
|
||||
auto add_texture(texture tex, GLuint unit = 0) -> void;
|
||||
auto add_buffer(buffer buf, GLuint unit = 0) -> void;
|
||||
auto bind_all() -> void;
|
||||
auto count() const -> size_t;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user