Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

texture.h

00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /***************************************************************************
00003  *            texture.h
00004  *
00005  *  Fri Dec 17 10:58:05 CET 2004
00006  *  Copyright  2004  Jesper Fruergaard and Bent Bisballe
00007  *  {deva,jesper}@daimi.au.dk
00008  ****************************************************************************/
00009 
00010 /*
00011  *  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version.
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU General Public License
00022  *  along with this program; if not, write to the Free Software
00023  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef __LIBGPU_TEXTURE_H__
00027 #define __LIBGPU_TEXTURE_H__
00028 
00029 #include "glstuff.h"
00030 //#include "cgstuff.h"
00031 #include "types.h"
00032 
00033 #include "gpu.h"
00034 
00035 class FragmentProgram;
00036 
00039 class Texture {
00040 friend class Gpu;
00041 friend class Kernel;
00042 friend class Parameter;
00043 public:
00049   Texture(int _width, int _height, int _bits = 32);
00050   ~Texture();
00051 
00055   void upload(float4 *data);
00056 
00060   void download(float4 *data);
00061 
00065   void clear(float4 *val = NULL);
00066 
00073   float4 reduce(FragmentProgram* prg);
00074 
00078   float4 max();
00079 
00083   float4 min();
00084 
00088   float4 avg();
00089 
00093   float4 sum();
00094 
00097   void show();
00098 
00099 private:
00100   bool setup;
00101   GLuint getId();
00102   GLint getInternalFormat() {
00103     return internalFormat;
00104   }
00105 
00106   void grabPBuffer();
00107 
00108   bool is2Dtype() {
00109     return target == GL_TEXTURE_2D;
00110   }
00111   bool isRECTtype() {
00112     return target == GL_TEXTURE_RECTANGLE_NV;
00113   }
00114 
00115   int width;
00116   int height;
00117   int bits;
00118   GLint internalFormat;
00119   GLenum target;
00120   Gpu* gpu;
00121   GLuint id;
00122 };
00123 
00124 
00125 #endif/*__LIBGPU_TEXTURE_H__*/

Generated on Sun Jan 9 19:22:05 2005 for libGPGPU by doxygen 1.3.6