00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_VIDEO_GL_TEXTURE_HPP 00018 #define HEADER_SUPERTUX_VIDEO_GL_TEXTURE_HPP 00019 00020 #include "video/texture.hpp" 00021 00027 class GLTexture : public Texture 00028 { 00029 protected: 00030 GLuint handle; 00031 unsigned int texture_width; 00032 unsigned int texture_height; 00033 unsigned int image_width; 00034 unsigned int image_height; 00035 00036 public: 00037 GLTexture(unsigned int width, unsigned int height); 00038 GLTexture(SDL_Surface* image); 00039 ~GLTexture(); 00040 00041 const GLuint &get_handle() const { 00042 return handle; 00043 } 00044 00045 void set_handle(GLuint handle) { 00046 this->handle = handle; 00047 } 00048 00049 unsigned int get_texture_width() const 00050 { 00051 return texture_width; 00052 } 00053 00054 unsigned int get_texture_height() const 00055 { 00056 return texture_height; 00057 } 00058 00059 unsigned int get_image_width() const 00060 { 00061 return image_width; 00062 } 00063 00064 unsigned int get_image_height() const 00065 { 00066 return image_height; 00067 } 00068 00069 void set_image_width(unsigned int width) 00070 { 00071 image_width = width; 00072 } 00073 00074 void set_image_height(unsigned int height) 00075 { 00076 image_height = height; 00077 } 00078 00079 private: 00080 void set_texture_params(); 00081 }; 00082 00083 #endif 00084 00085 /* EOF */