From dc980454fcf70ada110a0b73ac957a732fef0e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 30 Jun 2014 01:12:39 +0200 Subject: [PATCH 1/3] TextureTools: fix shader compilation. Amazingly enough this worked until now. Maybe more strict NVidia GLSL compiler? --- src/Magnum/TextureTools/DistanceFieldShader.frag | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magnum/TextureTools/DistanceFieldShader.frag b/src/Magnum/TextureTools/DistanceFieldShader.frag index e74560091..b82c6d94b 100644 --- a/src/Magnum/TextureTools/DistanceFieldShader.frag +++ b/src/Magnum/TextureTools/DistanceFieldShader.frag @@ -64,7 +64,7 @@ out lowp float value; #ifdef TEXELFETCH_USABLE mediump ivec2 rotate(const mediump ivec2 vec) { - return mediump ivec2(-vec.y, vec.x); + return ivec2(-vec.y, vec.x); } bool hasValue(const mediump ivec2 position, const mediump ivec2 offset) { @@ -72,7 +72,7 @@ bool hasValue(const mediump ivec2 position, const mediump ivec2 offset) { } #else mediump vec2 rotate(const mediump vec2 vec) { - return mediump vec2(-vec.y, vec.x); + return vec2(-vec.y, vec.x); } bool hasValue(const mediump vec2 position, const mediump vec2 offset) { From 50897e0dc03127de94c7c9371ec259c412f88b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 30 Jun 2014 01:13:24 +0200 Subject: [PATCH 2/3] Reset also viewport to default framebuffer on named FB destruction. In text example the scene was rendered with viewport used for distance field computation, which is wrong. Also amazingly enough that worked until now. --- src/Magnum/Framebuffer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp index 1c707507e..cf028c4de 100644 --- a/src/Magnum/Framebuffer.cpp +++ b/src/Magnum/Framebuffer.cpp @@ -28,6 +28,7 @@ #include #include "Magnum/Context.h" +#include "Magnum/DefaultFramebuffer.h" #include "Magnum/Extensions.h" #include "Magnum/Image.h" #include "Magnum/Renderbuffer.h" @@ -92,7 +93,17 @@ Framebuffer::~Framebuffer() { /* If bound, remove itself from state */ Implementation::FramebufferState* state = Context::current()->state().framebuffer; if(state->readBinding == _id) state->readBinding = 0; - if(state->drawBinding == _id) state->drawBinding = 0; + + /* For draw binding reset also viewport */ + if(state->drawBinding == _id) { + state->drawBinding = 0; + + /** + * @todo Less ugly solution (need to call setViewportInternal() to + * reset the viewport to size of default framebuffer) + */ + defaultFramebuffer.bind(FramebufferTarget::Draw); + } glDeleteFramebuffers(1, &_id); } From a35ce64752035a1c1bf147a3b13862aea0c76fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 30 Jun 2014 01:15:13 +0200 Subject: [PATCH 3/3] MeshTools: make compile() actually working with indexed meshes. I was drunk out of my mind. Apparently didn't test once. --- src/Magnum/MeshTools/Compile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Magnum/MeshTools/Compile.cpp b/src/Magnum/MeshTools/Compile.cpp index b7243cf79..4f0c979d4 100644 --- a/src/Magnum/MeshTools/Compile.cpp +++ b/src/Magnum/MeshTools/Compile.cpp @@ -83,7 +83,7 @@ std::tuple, std::unique_ptr> compile(const std::tie(indexData, indexType, indexStart, indexEnd) = MeshTools::compressIndices(meshData.indices()); indexBuffer.reset(new Buffer{Buffer::Target::ElementArray}); - indexBuffer->setData(data, usage); + indexBuffer->setData(indexData, usage); mesh.setCount(meshData.indices().size()) .setIndexBuffer(*indexBuffer, 0, indexType, indexStart, indexEnd); @@ -155,12 +155,12 @@ std::tuple, std::unique_ptr> compile(const std::tie(indexData, indexType, indexStart, indexEnd) = MeshTools::compressIndices(meshData.indices()); indexBuffer.reset(new Buffer{Buffer::Target::ElementArray}); - indexBuffer->setData(data, usage); + indexBuffer->setData(indexData, usage); mesh.setCount(meshData.indices().size()) .setIndexBuffer(*indexBuffer, 0, indexType, indexStart, indexEnd); /* Else set vertex count */ - } mesh.setCount(meshData.positions(0).size()); + } else mesh.setCount(meshData.positions(0).size()); return std::make_tuple(std::move(mesh), std::move(vertexBuffer), std::move(indexBuffer)); }