4a95407d0e
- cpp/functions/gfx/gl_loader.{h,cpp,md}: mini loader para OpenGL 2.0+
(Linux no-op via GL_GLEXT_PROTOTYPES, Windows wglGetProcAddress)
- Portar gl_shader/gl_framebuffer/fullscreen_quad/shader_canvas al loader
- CMakeLists: WIN32_EXECUTABLE para lanzar sin consola en Windows
- apps/shaders_lab/shaders_lab.exe: binario PE32+ precompilado
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
694 B
C++
28 lines
694 B
C++
#include "gfx/gl_loader.h"
|
|
#include "gfx/fullscreen_quad.h"
|
|
|
|
namespace fn::gfx {
|
|
|
|
void quad_init(Quad& q) {
|
|
glGenVertexArrays(1, &q.vao);
|
|
glGenBuffers(1, &q.vbo);
|
|
// Vertex shader generates positions from gl_VertexID — VBO stays empty.
|
|
glBindVertexArray(q.vao);
|
|
glBindBuffer(GL_ARRAY_BUFFER, q.vbo);
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
glBindVertexArray(0);
|
|
}
|
|
|
|
void quad_draw(const Quad& q) {
|
|
glBindVertexArray(q.vao);
|
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
|
glBindVertexArray(0);
|
|
}
|
|
|
|
void quad_destroy(Quad& q) {
|
|
if (q.vao) { glDeleteVertexArrays(1, &q.vao); q.vao = 0; }
|
|
if (q.vbo) { glDeleteBuffers(1, &q.vbo); q.vbo = 0; }
|
|
}
|
|
|
|
} // namespace fn::gfx
|