00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __SGL_TEXTURE_1D_HPP
00026 #define __SGL_TEXTURE_1D_HPP
00027
00028 #include <sgl.h>
00029 #include <vector>
00030 #include <sglObject.hpp>
00031 #include <sglVector.hpp>
00032 #include <sglTexture.hpp>
00033
00034
00035
00039 class SGL_DLL_API sglTexture1D : public sglTexture
00040 {
00041 public:
00043 sglTexture1D();
00045 virtual ~sglTexture1D();
00046
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 bool setImage(void *image, ExternalFormatEnum format, TypeEnum type,
00060 unsigned int num_s, bool border = false);
00062 void getImage(void *&image, ExternalFormatEnum &format, TypeEnum &type,
00063 unsigned int &num_s, bool &border) const;
00064
00069 bool setMipmapLevels(const vector<void *> &images);
00070
00072
00073
00074
00075
00076
00077
00078
00079 bool subloadImage(void *sub_image,
00080 GLint level,
00081 GLint offset_x,
00082 GLint width);
00083
00089 virtual bool replaceImage(void *new_image, GLint level = 0);
00090
00092 inline void getSize(unsigned int &width) const { width = m_width; }
00093
00097 virtual unsigned int getIdealInternalSize() const;
00102 virtual unsigned int getLikelyInternalSize() const;
00103
00105 void setWrapMode(WrapEnum s_repeat_flag);
00107 void getWrapMode(WrapEnum &s_repeat_flag) const;
00108
00114 virtual bool checkProxy();
00115
00121 virtual void bind();
00122
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 bool copyTexSubImage(GLint level,
00135 GLint offset_x,
00136 GLint win_x, GLint win_y,
00137 GLint width);
00138
00144 virtual bool buildMipmaps(vector<void*> &mipmaps);
00145
00159 static bool resizeImage(sglTexture::ExternalFormatEnum format,
00160 sglTexture::TypeEnum type,
00161 unsigned int old_s,
00162 bool border,
00163 unsigned int new_s,
00164 void *old_image, void *&new_image);
00165
00179 static bool halveImage(sglTexture::ExternalFormatEnum format,
00180 sglTexture::TypeEnum type,
00181 unsigned int &num_s,
00182 bool border,
00183 void *old_image, void *&new_image);
00184
00185
00186 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00187
00188 private:
00189 sglTexture1D(const sglTexture1D&);
00190 sglTexture1D& operator=(const sglTexture1D &);
00191
00192
00193 struct SubloadImageStruct
00194 {
00195 SubloadImageStruct(void* sub_image,
00196 GLint level, GLint offset_x, GLint width)
00197 : m_sub_image(sub_image), m_level(level),
00198 m_offset_x(offset_x), m_width(width) {};
00199
00200 void *m_sub_image;
00201 GLint m_level;
00202 GLint m_offset_x;
00203 GLint m_width;
00204 };
00205
00206 private:
00207 unsigned int m_width;
00208 GLint m_repeat_flag;
00209 GLint m_pow_s;
00210
00211 vector <SubloadImageStruct*> m_subload_list;
00212 };
00213
00214 #endif