feat: render per-vertex color triangle

- Add shader class for vertex/fragment program compilation
- Add vao class for vertex array object management
- Render RGB gradient triangle with interpolated vertex colors
This commit is contained in:
2026-05-05 22:05:40 +02:00
parent 90d013695d
commit df08210f77
6 changed files with 279 additions and 5 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <string>
#include "glad/glad.h"
namespace cbt::opengl {
class shader {
GLuint m_id = 0;
public:
shader();
~shader();
shader(const shader&) = delete;
shader& operator=(const shader&) = delete;
shader(shader&& other) noexcept;
shader& operator=(shader&& other) noexcept;
auto compile_vertex(const char* source) -> bool;
auto compile_fragment(const char* source) -> bool;
auto link() -> bool;
auto use() const -> void;
auto unuse() const -> void;
auto id() const -> GLuint;
auto valid() const -> bool;
};
}