]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / texture.cpp
diff --git a/source/texture.cpp b/source/texture.cpp
deleted file mode 100644 (file)
index 40f18d4..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include "except.h"
-#include "texture.h"
-#include "texunit.h"
-
-using namespace std;
-
-namespace Msp {
-namespace GL {
-
-istream &operator>>(istream &in, TextureFilter &tf)
-{
-       string str;
-       in>>str;
-
-       if(str=="NEAREST")
-               tf = NEAREST;
-       else if(str=="LINEAR")
-               tf = LINEAR;
-       else if(str=="NEAREST_MIPMAP_NEAREST")
-               tf = NEAREST_MIPMAP_NEAREST;
-       else if(str=="NEAREST_MIPMAP_LINEAR")
-               tf = NEAREST_MIPMAP_LINEAR;
-       else if(str=="LINEAR_MIPMAP_NEAREST")
-               tf = LINEAR_MIPMAP_NEAREST;
-       else if(str=="LINEAR_MIPMAP_LINEAR")
-               tf = LINEAR_MIPMAP_LINEAR;
-       else
-               in.setstate(ios_base::failbit);
-
-       return in;
-}
-
-
-void Texture::bind() const
-{
-       if(!target)
-               throw InvalidState("Attempt to bind a texture without target");
-
-       const Texture *cur = TexUnit::current().get_texture();
-       if(cur!=this)
-       {
-               if(cur && cur->target!=target)
-                       glDisable(cur->target);
-               if(!cur || cur->target!=target)
-                       glEnable(target);
-               glBindTexture(target, id);
-               TexUnit::current().set_texture(this);
-       }
-}
-
-void Texture::bind_to(unsigned i) const
-{
-       TexUnit::activate(i);
-       bind();
-}
-
-void Texture::parameter(GLenum param, int value)
-{
-       maybe_bind();
-
-       glTexParameteri(target, param, value);
-}
-
-void Texture::parameter(GLenum param, float value)
-{
-       maybe_bind();
-
-       glTexParameterf(target, param, value);
-}
-
-Texture::~Texture()
-{
-       glDeleteTextures(1, &id);
-}
-
-void Texture::unbind()
-{
-       const Texture *cur = TexUnit::current().get_texture();
-       if(!cur)
-               return;
-
-       glBindTexture(cur->target, 0);
-       glDisable(cur->target);
-       TexUnit::current().set_texture(0);
-}
-
-void Texture::unbind_from(unsigned i)
-{
-       TexUnit::activate(i);
-       unbind();
-}
-
-Texture::Texture():
-       target(0)
-{
-       glGenTextures(1, &id);
-}
-
-void Texture::maybe_bind() const
-{
-       if(TexUnit::current().get_texture()!=this)
-               bind();
-}
-
-
-Texture::Loader::Loader(Texture &t):
-       DataFile::ObjectLoader<Texture>(t)
-{
-       add("min_filter", &Loader::min_filter);
-       add("mag_filter", &Loader::mag_filter);
-       add("generate_mipmap", &Loader::generate_mipmap);
-}
-
-void Texture::Loader::min_filter(TextureFilter f)
-{
-       obj.set_min_filter(f);
-}
-
-void Texture::Loader::mag_filter(TextureFilter f)
-{
-       obj.set_mag_filter(f);
-}
-
-void Texture::Loader::generate_mipmap(bool gm)
-{
-       obj.parameter(GL_GENERATE_MIPMAP_SGIS, gm);
-}
-
-} // namespace GL
-} // namespace Msp