From b5e21184071e02b2e909316a23bb9b2fdb6ec701 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Sun, 28 Aug 2011 17:11:22 +0200 Subject: [PATCH] fbo: cleaned up shader: added filter (mandatory) --- J/fbo.h | 2 +- J/shader.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/J/fbo.h b/J/fbo.h index 39c239f..6943117 100644 --- a/J/fbo.h +++ b/J/fbo.h @@ -23,7 +23,6 @@ // TODO: more error checking in debug build. // TODO: make texture class? for easier switching between linear/nearest interpolation for example // NOTE: stencil attachment is not supported -// NOTE: in end() we don't set a viewport, because it will be always set (the 'main' fbo is also an J::fbo) namespace J { @@ -84,6 +83,7 @@ public: void end(){ unbind(); + // NOTE: we don't set a viewport, because it will be always set (the 'main' fbo is also an J::fbo) } private: diff --git a/J/shader.h b/J/shader.h index 917597e..423e2b0 100644 --- a/J/shader.h +++ b/J/shader.h @@ -181,9 +181,11 @@ public: } // textures (see todo above) - void set_texture(const char* name, GLenum target, GLuint tex, int textureLocation) const { + void set_texture(const char* name, GLenum target, GLuint tex, int textureLocation, GLenum filter = GL_LINEAR) const { glActiveTexture(GL_TEXTURE0 + textureLocation); glBindTexture(target, tex); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); set_uniform(name, textureLocation); }