aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/texture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu/texture.cpp')
-rw-r--r--src/menu/texture.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/menu/texture.cpp b/src/menu/texture.cpp
index bae6dc2c..4ad0c39e 100644
--- a/src/menu/texture.cpp
+++ b/src/menu/texture.cpp
@@ -29,13 +29,24 @@ namespace usdx
log4cpp::Category& Texture::log =
log4cpp::Category::getInstance("usdx.base.texture");
+ const GLfloat Texture::default_vertices[] = { 0.0f, 1.0f,
+ 1.0f, 1.0f,
+ 1.0f, 0.0f,
+ 0.0f, 0.0f };
+
Texture::Texture(boost::filesystem::wpath filename) :
filename(filename), texture(0), size(0, 0), rotation(0)
{
- Image image(filename);
+ }
- size.set_width(image.get_surface()->w);
- size.set_height(image.get_surface()->h);
+ Texture::~Texture()
+ {
+ }
+
+ void Texture::gl_initialize()
+ {
+ Image image(filename);
+ size = image.get_size();
// // Check that the image dimensions are a power of 2
// if ((image.get_surface()->w & (image.get_surface()->w - 1)) != 0 ) {
@@ -98,15 +109,26 @@ namespace usdx
image.get_surface()->pixels);
}
- Texture::~Texture()
+ void Texture::gl_cleanup()
{
if (glIsTexture(texture)) {
glDeleteTextures(1, &texture);
}
}
- GLuint Texture::get_texture(void) const
+ void Texture::enable(void)
+ {
+ GlDelayedAllocation::enable();
+
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, texture);
+
+ }
+
+ void Texture::disable(void)
{
- return texture;
+ GlDelayedAllocation::disable();
+
+ glDisable(GL_TEXTURE_2D);
}
};