Distributed under the LGPL
*/
+#include "bindable.h"
#include "except.h"
#include "texture2d.h"
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)
{
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);
}
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);
}