X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture.cpp;h=f1689145c8af9c5754569213a7561b0505e63b2c;hp=d12e18e0fa4766efd60bf46ff594376f7796b546;hb=HEAD;hpb=7adcad3b40a03000a82e32db4523761c218309b8 diff --git a/source/texture.cpp b/source/texture.cpp deleted file mode 100644 index d12e18e0..00000000 --- a/source/texture.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "texture.h" - -namespace Msp { -namespace GL { - -void Texture::bind() const -{ - if(!target) return; - - glEnable(target); - glBindTexture(target, id); - bound=this; -} - -void Texture::parameter(GLenum param, int value) -{ - if(bound!=this) bind(); - - glTexParameteri(target, param, value); -} - -void Texture::parameter(GLenum param, float value) -{ - if(bound!=this) bind(); - - glTexParameterf(target, param, value); -} - -sizei Texture::get_width(int level) const -{ - if(bound!=this) bind(); - - int width; - glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); - return width; -} - -sizei Texture::get_height(int level) const -{ - if(bound!=this) bind(); - - int height; - glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); - return height; -} - -sizei Texture::get_depth(int level) const -{ - if(bound!=this) bind(); - - int depth; - glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); - return depth; -} - -Texture::~Texture() -{ - glDeleteTextures(1, &id); -} - -Texture::Texture(): - target(0) -{ - glGenTextures(1, &id); -} - -const Texture *Texture::bound=0; - -} // namespace GL -} // namespace Msp