summaryrefslogtreecommitdiffstats
path: root/src/GalOgl.cpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-11-21 09:56:28 +0100
committerLaG1924 <lag1924@gmail.com>2021-11-21 10:26:47 +0100
commitaafc423a7298b0fc595c0209480474dc50c277f0 (patch)
tree06549c939c99cfd8a6f3390362eea2a5c5b88b9e /src/GalOgl.cpp
parentFixed some broken graphics features (diff)
downloadAltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar.gz
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar.bz2
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar.lz
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar.xz
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.tar.zst
AltCraft-aafc423a7298b0fc595c0209480474dc50c277f0.zip
Diffstat (limited to 'src/GalOgl.cpp')
-rw-r--r--src/GalOgl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/GalOgl.cpp b/src/GalOgl.cpp
index 29e7fc0..c250539 100644
--- a/src/GalOgl.cpp
+++ b/src/GalOgl.cpp
@@ -137,6 +137,7 @@ public:
if (activeTexture[textureUnit] != texture) {
SetTextureUnit(textureUnit);
glBindTexture(type, texture);
+ activeTexture[textureUnit] = texture;
}
glCheckError();
}
@@ -690,6 +691,7 @@ struct FramebufferOgl : public Framebuffer {
size_t vpX = 0, vpY = 0, vpW = 1, vpH = 1;
std::shared_ptr<TextureOgl> depthStencil;
std::vector<std::shared_ptr<TextureOgl>> colors;
+ std::vector<GLenum> attachments;
GlResource fbo;
@@ -853,6 +855,8 @@ struct PipelineOgl : public Pipeline {
oglState.UseProgram(program);
oglState.BindFbo(target->fbo);
oglState.SetViewport(target->vpX, target->vpY, target->vpW, target->vpH);
+ if (target->fbo)
+ glDrawBuffers(target->attachments.size(), target->attachments.data());
for (size_t i = 0; i < staticTextures.size(); i++) {
oglState.BindTexture(staticTextures[i]->type, staticTextures[i]->texture, i);
@@ -1226,6 +1230,7 @@ struct ImplOgl : public Impl {
glUniform1i(location, usedTextureBlocks);
pipeline->staticTextures.push_back(texture);
+ usedTextureBlocks++;
}
glCheckError();
@@ -1299,6 +1304,7 @@ struct ImplOgl : public Impl {
for (auto&& [location, texture] : conf->colors) {
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + location, texture->type, texture->texture, 0);
fb->colors.emplace_back(std::move(texture));
+ fb->attachments.push_back(GL_COLOR_ATTACHMENT0 + location);
}
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
@@ -1315,6 +1321,7 @@ struct ImplOgl : public Impl {
if (!fbDefault)
fbDefault = std::make_shared<FramebufferOgl>();
fbDefault->fbo = GlResource(0, GlResourceType::None);
+ fbDefault->attachments.push_back(GL_COLOR_ATTACHMENT0);
return std::static_pointer_cast<Framebuffer, FramebufferOgl>(fbDefault);
}