00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024 #ifndef SH_GLTEXTURENAME_HPP
00025 #define SH_GLTEXTURENAME_HPP
00026
00027 #include "GlBackend.hpp"
00028 #include "ShMemory.hpp"
00029
00030
00031 namespace shgl {
00032
00033 class GlTextureName : public SH::ShRefCountable {
00034 public:
00035 GlTextureName(GLenum target);
00036
00037
00038 GlTextureName(GLenum target, GLuint name);
00039
00040 ~GlTextureName();
00041
00042 GLuint value() const { return m_name; }
00043 GLenum target() const { return m_target; }
00044 const SH::ShTextureTraits& params() const { return m_params; }
00045 void params(const SH::ShTextureTraits& params);
00046
00047 void addStorage(SH::ShStorage* storage);
00048 void removeStorage(SH::ShStorage* storage);
00049
00050 typedef std::list<SH::ShStorage*> StorageList;
00051 StorageList::const_iterator beginStorages() const { return m_storages.begin(); }
00052 StorageList::const_iterator endStorages() const { return m_storages.end(); }
00053
00054 typedef std::list<GlTextureName*> NameList;
00055 static NameList::const_iterator beginNames() { return m_names->begin(); }
00056 static NameList::const_iterator endNames() { return m_names->end(); }
00057
00058
00059 struct Binding {
00060 Binding(const SH::ShPointer<const GlTextureName>& name);
00061 ~Binding();
00062
00063 GLenum target;
00064 GLint last;
00065 };
00066
00067 private:
00068 GLenum m_target;
00069 GLuint m_name;
00070 StorageList m_storages;
00071 static NameList* m_names;
00072 SH::ShTextureTraits m_params;
00073
00074 bool m_managed;
00075 };
00076
00077 typedef SH::ShPointer<GlTextureName> GlTextureNamePtr;
00078
00079 }
00080
00081 #endif