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
00027 #ifndef SH_GLTEXTURENAME_HPP
00028 #define SH_GLTEXTURENAME_HPP
00029
00030 #include "GlBackend.hpp"
00031 #include "ShMemory.hpp"
00032
00033
00034 namespace shgl {
00035
00036 class GlTextureName : public SH::ShRefCountable {
00037 public:
00038 GlTextureName(GLenum target);
00039
00040
00041 GlTextureName(GLenum target, GLuint name);
00042
00043 ~GlTextureName();
00044
00045 GLuint value() const { return m_name; }
00046 GLenum target() const { return m_target; }
00047 const SH::ShTextureTraits& params() const { return m_params; }
00048 void params(const SH::ShTextureTraits& params);
00049
00050 void addStorage(SH::ShStorage* storage);
00051 void removeStorage(SH::ShStorage* storage);
00052
00053 typedef std::list<SH::ShStorage*> StorageList;
00054 StorageList::const_iterator beginStorages() const { return m_storages.begin(); }
00055 StorageList::const_iterator endStorages() const { return m_storages.end(); }
00056
00057 typedef std::list<GlTextureName*> NameList;
00058 static NameList::const_iterator beginNames() { return m_names.begin(); }
00059 static NameList::const_iterator endNames() { return m_names.end(); }
00060
00061
00062 struct Binding {
00063 Binding(const SH::ShPointer<const GlTextureName>& name);
00064 ~Binding();
00065
00066 GLenum target;
00067 GLint last;
00068 };
00069
00070 private:
00071 GLenum m_target;
00072 GLuint m_name;
00073 StorageList m_storages;
00074 static NameList m_names;
00075 SH::ShTextureTraits m_params;
00076
00077 bool m_managed;
00078 };
00079
00080 typedef SH::ShPointer<GlTextureName> GlTextureNamePtr;
00081
00082 }
00083
00084 #endif