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

Generated on Thu Apr 21 17:32:45 2005 for Sh by  doxygen 1.4.2