From ab8c1e0eeffedb0e5979874fba64b305effdb2d3 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Wed, 30 Jun 2010 23:31:01 +0200 Subject: Changed Texture-API. --- texture.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'texture.cpp') diff --git a/texture.cpp b/texture.cpp index c3575f2..c8c5541 100644 --- a/texture.cpp +++ b/texture.cpp @@ -3,14 +3,30 @@ #include "texture.h" #include -unsigned int Texture::tex() { +void Texture::bind() const { + glBindTexture(GL_TEXTURE_2D, texture); +} + +unsigned int Texture::tex() const { return texture; } -void Texture::build() { +unsigned int Texture::w() const { + return width; +} + +unsigned int Texture::h() const { + return height; +} + +void Texture::build(void* data, unsigned int format, unsigned int w, unsigned int h) { if(!data) { throw(std::runtime_error("No texture data")); } + + width = w; + height = h; + glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -- cgit v1.2.3