Go to the documentation of this file.00001
00009 #ifndef __TEXTURE_H__
00010 #define __TEXTURE_H__
00011
00012 #include <blort/Tracker/headers.h>
00013 #include <opencv2/core/core.hpp>
00014
00015 namespace Tracking{
00016
00020 class Texture
00021 {
00022 private:
00023 GLuint m_texture_id;
00024 unsigned m_width;
00025 unsigned m_height;
00026 int m_res_id;
00027
00028 public:
00029 Texture();
00030 ~Texture();
00031
00032 bool load(unsigned char* image_data, unsigned width, unsigned height, GLenum format=GL_BGR);
00033 bool load(const char* filename);
00034 bool save(const char* filename);
00035 bool getImageData(unsigned char* image_data);
00036
00037 void bind(int stage=0);
00038 void copyTexImage2D(unsigned width, unsigned height);
00039 void copyTexImage2D(int x, int y, unsigned width, unsigned height);
00040 void copyFromTexture(Texture* tex);
00041 void copyFromTexture(Texture* tex, int x, int y, unsigned w, unsigned h);
00042
00043 inline GLuint getTextureID(){ return m_texture_id; }
00044 inline unsigned getWidth(){ return m_width; }
00045 inline unsigned getHeight(){ return m_height; }
00046 inline int getResID(){ return m_res_id; }
00047 inline void setResID(int id){ m_res_id = id; }
00048 cv::Mat toCvMat();
00049
00050
00051 };
00052
00053 }
00054
00055 #endif