+++ /dev/null
-#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