From 78b4b043a4fe6be84dd36717c832951a0a464f63 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 10 Mar 2026 01:51:38 +0000 Subject: Switch frame and render buffer to DSA helpers --- test/testRenderOutput.cpp | 23 +++++++++-------------- test/testRenderOutput.h | 6 +++--- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/testRenderOutput.cpp b/test/testRenderOutput.cpp index b86469a..e2cc437 100644 --- a/test/testRenderOutput.cpp +++ b/test/testRenderOutput.cpp @@ -1,25 +1,20 @@ #include "testRenderOutput.h" #include -#include TestRenderOutput::TestRenderOutput(TextureAbsCoord outputSize) : size {outputSize} { - glBindFramebuffer(GL_FRAMEBUFFER, output); - const auto configuregdata = [this](glTexture & data, const GLenum format, const GLenum attachment) { - data.storage(1, format, size); + const auto configureAttachment = [this](glFramebuffer & fbo, glTexture & data, const GLenum iformat, + const GLenum attachment) { + data.storage(1, iformat, size); data.parameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST); data.parameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, data, 0); + fbo.texture(attachment, data); }; - configuregdata(outImage, GL_RGBA8, GL_COLOR_ATTACHMENT0); - glDrawBuffer(GL_COLOR_ATTACHMENT0); + configureAttachment(output, outImage, GL_RGBA8, GL_COLOR_ATTACHMENT0); + output.drawBuffers(GL_COLOR_ATTACHMENT0); - glBindRenderbuffer(GL_RENDERBUFFER, depth); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, size.x, size.y); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); + depth.storage(GL_DEPTH_COMPONENT, size); + output.buffer(GL_DEPTH_ATTACHMENT, depth); - // finally check if framebuffer is complete - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - throw std::runtime_error("Framebuffer not complete!"); - } + output.assertComplete(); } diff --git a/test/testRenderOutput.h b/test/testRenderOutput.h index 248485c..e68d1f3 100644 --- a/test/testRenderOutput.h +++ b/test/testRenderOutput.h @@ -2,7 +2,7 @@ #include "config/types.h" #include "game/gamestate.h" -#include "glArrays.h" +#include "gfx/gl/glFramebuffer.h" #include #include @@ -15,8 +15,8 @@ public: NO_COPY(TestRenderOutput); const TextureAbsCoord size; - glFrameBuffer output; - glRenderBuffer depth; + glFramebuffer output; + glRenderbuffer depth; glTexture outImage; GameState gameState; }; -- cgit v1.3