X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture2d.cpp;h=8935933f995117322069ad1652b6b1d9ffc87d0c;hb=7e9e15a12fb398798f2719545cc8553354c1e389;hp=197e04df63830269f92a04ed4279636319ef4344;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;p=libs%2Fgl.git diff --git a/source/texture2d.cpp b/source/texture2d.cpp index 197e04df..8935933f 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include "bindable.h" #include "except.h" #include "texture2d.h" @@ -14,12 +15,10 @@ namespace Msp { namespace GL { Texture2D::Texture2D(): + Texture(GL_TEXTURE_2D), width(0), height(0) -{ - target = GL_TEXTURE_2D; - bind(); -} +{ } void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, int brd) { @@ -39,8 +38,7 @@ void Texture2D::image(int level, PixelFormat fmt, DataType type, const void *dat if(width==0) throw InvalidState("Texture storage has not been specified"); - maybe_bind(); - + Bind _bind(this, true); glTexImage2D(target, level, ifmt, width, height, border, fmt, type, data); } @@ -49,8 +47,7 @@ void Texture2D::sub_image(int level, int x, int y, unsigned wd, unsigned ht, Pix if(width==0) throw InvalidState("Texture storage has not been specified"); - maybe_bind(); - + Bind _bind(this, true); glTexSubImage2D(target, level, x, y, wd, ht, fmt, type, data); }