Browse Source

fbo: cleaned up

shader: added filter (mandatory)
master
Joshua Moerman 14 years ago
parent
commit
b5e2118407
  1. 2
      J/fbo.h
  2. 4
      J/shader.h

2
J/fbo.h

@ -23,7 +23,6 @@
// TODO: more error checking in debug build. // TODO: more error checking in debug build.
// TODO: make texture class? for easier switching between linear/nearest interpolation for example // TODO: make texture class? for easier switching between linear/nearest interpolation for example
// NOTE: stencil attachment is not supported // 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 { namespace J {
@ -84,6 +83,7 @@ public:
void end(){ void end(){
unbind(); unbind();
// NOTE: we don't set a viewport, because it will be always set (the 'main' fbo is also an J::fbo)
} }
private: private:

4
J/shader.h

@ -181,9 +181,11 @@ public:
} }
// textures (see todo above) // 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); glActiveTexture(GL_TEXTURE0 + textureLocation);
glBindTexture(target, tex); 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); set_uniform(name, textureLocation);
} }