From 56cac343bffe5413d0d5e691040d0a198655c5af Mon Sep 17 00:00:00 2001 From: Peter Schaefer Date: Sat, 16 Apr 2016 10:44:31 +0200 Subject: [PATCH] fixed fBO (disabled MipMap) --- Weave/Graphix/Model/Model.cpp | 1 + Weave/Graphix/Model/Plane.cpp | 4 ++-- Weave/Graphix/Textures/Texture.cpp | 8 ++++++-- Weave/Graphix/Textures/fBufferObject.cpp | 5 +++-- Weave/Scene/Scene.cpp | 10 +++++----- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Weave/Graphix/Model/Model.cpp b/Weave/Graphix/Model/Model.cpp index 4a28612..5ea99ca 100644 --- a/Weave/Graphix/Model/Model.cpp +++ b/Weave/Graphix/Model/Model.cpp @@ -245,6 +245,7 @@ Model* Model::getPlaneModel() PlaneModel = new Plane(); PlaneModel->bindModel(); PlaneModel->bindShader(Shader::gBasicTexture()); + PlaneModel->bindShader(Shader::gBlur()); } return PlaneModel; } diff --git a/Weave/Graphix/Model/Plane.cpp b/Weave/Graphix/Model/Plane.cpp index fb07a86..c34955d 100644 --- a/Weave/Graphix/Model/Plane.cpp +++ b/Weave/Graphix/Model/Plane.cpp @@ -34,8 +34,8 @@ void Plane::drawModel() const Shader::gActive()->setUniformLocation("uPlain", 1); Shader::gActive()->setUniformLocation("uFar", 0); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - //glDrawArrays(GL_QUADS, 0, 4); + //glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_QUADS, 0, 4); glBindVertexArray(0); } diff --git a/Weave/Graphix/Textures/Texture.cpp b/Weave/Graphix/Textures/Texture.cpp index 4276fd3..c08d34b 100644 --- a/Weave/Graphix/Textures/Texture.cpp +++ b/Weave/Graphix/Textures/Texture.cpp @@ -11,7 +11,7 @@ using std::unordered_map; Texture::Texture() - : texture_internal(GL_RGB16F), texture_format(GL_RGB),texture_target(GL_TEXTURE_2D),texture_type(GL_FLOAT) + : texture_internal(GL_RGB), texture_format(GL_RGB),texture_target(GL_TEXTURE_2D),texture_type(GL_UNSIGNED_BYTE) { glGenTextures(1, &handle); } @@ -76,7 +76,11 @@ void Texture::bindTexture(unsigned int _width, unsigned int _height) glBindTexture(texture_target, handle); - glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if(data!=nullptr) + glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + else + glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); diff --git a/Weave/Graphix/Textures/fBufferObject.cpp b/Weave/Graphix/Textures/fBufferObject.cpp index 8ab4a66..ea23db1 100644 --- a/Weave/Graphix/Textures/fBufferObject.cpp +++ b/Weave/Graphix/Textures/fBufferObject.cpp @@ -65,9 +65,10 @@ void fBufferObject::bindBuffer(unsigned int _width, unsigned int _height) rBO->bindBuffer(_width, _height); glFramebufferRenderbuffer(buffer_target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, *rBO); } - - //glDrawBuffers(dim, attachments); + //glDrawBuffers(1, attachments); + + glDrawBuffers(dim, attachments); if (glCheckFramebufferStatus(buffer_target) != GL_FRAMEBUFFER_COMPLETE) Message::error("fBufferObject: Framebuffer not complete!"); diff --git a/Weave/Scene/Scene.cpp b/Weave/Scene/Scene.cpp index 9f136b0..d0f1204 100644 --- a/Weave/Scene/Scene.cpp +++ b/Weave/Scene/Scene.cpp @@ -59,9 +59,9 @@ lookat(_lookat) render = new fBufferObject(1); - blur = new fBufferObject(2,false); +// blur = new fBufferObject(2,false); - blur->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight()); +// blur->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight()); render->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight()); render->clearBuffer(); @@ -197,9 +197,9 @@ void Scene::draw() const render->clearBuffer(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - Shader::gBasicTexture()->useShader(); - //render->getTexture()->useTexture(); - SceneObjects.front()->gTexture()->useTexture(); + Shader::gBlur()->useShader(); + render->getTexture()->useTexture(); + //SceneObjects.front()->gTexture()->useTexture(); Model::getPlaneModel()->drawModel(mat4(1.f)); } -- 2.47.3