Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

GlTextureStorage.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory
00004 // Project administrator: Michael D. McCool
00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa,
00006 //          Michael D. McCool
00007 // 
00008 // This software is provided 'as-is', without any express or implied
00009 // warranty. In no event will the authors be held liable for any damages
00010 // arising from the use of this software.
00011 // 
00012 // Permission is granted to anyone to use this software for any purpose,
00013 // including commercial applications, and to alter it and redistribute it
00014 // freely, subject to the following restrictions:
00015 // 
00016 // 1. The origin of this software must not be misrepresented; you must
00017 // not claim that you wrote the original software. If you use this
00018 // software in a product, an acknowledgment in the product documentation
00019 // would be appreciated but is not required.
00020 // 
00021 // 2. Altered source versions must be plainly marked as such, and must
00022 // not be misrepresented as being the original software.
00023 // 
00024 // 3. This notice may not be removed or altered from any source
00025 // distribution.
00027 #ifndef SH_GLTEXTURESTORAGE_HPP
00028 #define SH_GLTEXTURESTORAGE_HPP
00029 
00030 #include "ShVariableType.hpp"
00031 #include "ShMemory.hpp"
00032 #include "GlBackend.hpp"
00033 #include "GlTextureName.hpp"
00034 
00035 namespace shgl {
00036 
00037 class GlTextureStorage : public SH::ShStorage {
00038 public:
00039   GlTextureStorage(SH::ShMemory* memory, GLenum target,
00040                    GLenum format, GLint internalFormat,
00041                    SH::ShValueType valueType, 
00042                    int width, int height, int depth, int tuplesize,
00043                    int count, GlTextureNamePtr name);
00044   
00045   ~GlTextureStorage();
00046   
00047   std::string id() const { return "opengl:texture"; }
00048   
00049   GLuint name() const { return m_name->value(); }
00050   const GlTextureNamePtr& texName() const { return m_name; }
00051   GLenum target() const { return m_target; }
00052   GLenum format() const { return m_format; }
00053   GLint internalFormat() const { return m_internalFormat; }
00054   SH::ShValueType valueType() const { return m_valueType; }
00055   int width() const { return m_width; }
00056   int height() const { return m_height; }
00057   int depth() const { return m_depth; }
00058   int tuplesize() const { return m_tuplesize; }
00059   int count() const { return (m_count != -1) ? m_count : m_width * m_height * m_depth; }
00060   
00061 private:
00062   GlTextureNamePtr m_name;
00063 
00064   // OpenGL texture params.  type will be determined by the Transfer function
00065   GLenum m_target;
00066   GLenum m_format;
00067   GLint m_internalFormat;
00068 
00069   SH::ShValueType m_valueType; // type index expected of data on host
00070   int m_width, m_height, m_depth, m_tuplesize, m_count;
00071   
00072   unsigned int m_params;
00073 
00074   GlTextureStorage(const GlTextureStorage&);
00075   GlTextureStorage& operator=(const GlTextureStorage&);
00076   
00077   // TODO: Mipmapping?
00078 };
00079 
00080 typedef SH::ShPointer<GlTextureStorage> GlTextureStoragePtr;
00081 
00082 }
00083 
00084 #endif

Generated on Mon Jan 24 18:36:29 2005 for Sh by  doxygen 1.4.1