texture.hpp

Go to the documentation of this file.
00001 /*
00002     RenderStack  Support library for OpenGL 3+
00003     Copyright (C) 2010  Timo Suoranta
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00027 #ifndef TEXTURE_HPP
00028 #define TEXTURE_HPP
00029 
00030 #include "renderstack/rs.h"
00031 #include <vector>
00032 
00033 namespace renderstack {
00034 
00036 class renderbuffer
00037 {
00038 public:
00039     renderbuffer();
00040     renderbuffer(int gl_renderbuffer_object);
00041     renderbuffer(int width, int height, int gl_format, int sample_count);
00042 
00043     void set(int gl_renderbuffer_object);
00044     void set(int width, int height, int gl_format, int sample_count);
00045 
00046     unsigned int gl_renderbuffer_object() const { return m_gl_renderbuffer_object; }
00047 
00048 private:
00049     unsigned int m_gl_renderbuffer_object;
00050 };
00051 
00053 class texture
00054 {
00055 public:
00056     texture();
00057     texture(
00058         int width,
00059         int height,
00060         int gl_bind_target,
00061         int gl_teximage_target,
00062         int gl_minification_filter,
00063         int gl_magnification_filter,
00064         int gl_wrap,
00065         int gl_format
00066     );
00067 
00068 public:
00069     void set(
00070         int width,
00071         int height,
00072         int gl_bind_target,
00073         int gl_teximage_target,
00074         int gl_minification_filter,
00075         int gl_magnification_filter,
00076         int gl_wrap,
00077         int gl_format
00078     );
00079 
00080     void set_data(std::vector<unsigned char> const &data);
00081     void set_data(int format, unsigned char* data);
00082     void update();
00083 
00084 public:
00085     int width                   () const { return m_width; }
00086     int height                  () const { return m_height; }
00087     int gl_bind_target          () const { return m_gl_bind_target; }
00088     int gl_teximage_target      () const { return m_gl_teximage_target; }
00089     int gl_texture_object       () const { return m_gl_texture_object; }
00090     int gl_minification_filter  () const { return m_gl_minification_filter; }
00091     int gl_magnification_filter () const { return m_gl_magnification_filter; }
00092     int gl_wrap                 () const { return m_gl_wrap; }
00093     int gl_format               () const { return m_gl_format; }
00094 
00095 private:
00096     int             m_width;
00097     int             m_height;
00098     int             m_gl_bind_target;             /*  GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP  */ 
00099     int             m_gl_teximage_target;         /*  GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, ...  */ 
00100     unsigned int    m_gl_texture_object;          /*  1, ... */ 
00101     int             m_gl_minification_filter;
00102     int             m_gl_magnification_filter;
00103     int             m_gl_wrap;
00104     int             m_gl_format;
00105 };
00106 
00107 }
00108 
00109 #endif
00110 
Generated on Sun Apr 11 12:23:09 2010 for RenderStack by  doxygen 1.6.3