00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkTextureObject_h
00026 #define __vtkTextureObject_h
00027
00028 #include "vtkObject.h"
00029 #include "vtkWeakPointer.h"
00030
00031 class vtkRenderWindow;
00032 class vtkOpenGLExtensionManager;
00033 class vtkPixelBufferObject;
00034
00035 class VTK_RENDERING_EXPORT vtkTextureObject : public vtkObject
00036 {
00037 public:
00038
00039
00040
00041 enum
00042 {
00043 Lequal=0,
00044 Gequal,
00045 Less,
00046 Greater,
00047 Equal,
00048 NotEqual,
00049 AlwaysTrue,
00050 Never
00051 };
00052
00053
00054 enum
00055 {
00056 Luminance=0,
00057 Intensity,
00058 Alpha
00059 };
00060
00061
00062 enum
00063 {
00064 Clamp=0,
00065 ClampToEdge,
00066 Repeat,
00067 ClampToBorder,
00068 MirroredRepeat
00069 };
00070
00071
00072 enum
00073 {
00074 Nearest=0,
00075 Linear,
00076 NearestMipmapNearest,
00077 NearestMipmapLinear,
00078 LinearMipmapNearest,
00079 LinearMipmapLinear
00080 };
00081
00082
00083 static vtkTextureObject* New();
00084 vtkTypeRevisionMacro(vtkTextureObject, vtkObject);
00085 void PrintSelf(ostream& os, vtkIndent indent);
00086
00088
00092 void SetContext(vtkRenderWindow*);
00093 vtkRenderWindow* GetContext();
00095
00097
00099 vtkGetMacro(Width, unsigned int);
00100 vtkGetMacro(Height, unsigned int);
00101 vtkGetMacro(Depth, unsigned int);
00102 vtkGetMacro(Components, int);
00104
00105 vtkGetMacro(NumberOfDimensions, int);
00106
00108
00109 vtkGetMacro(Target, int);
00111
00113
00114 vtkGetMacro(Handle, unsigned int);
00116
00118
00120 void Bind();
00121 void UnBind();
00123
00125 bool IsBound();
00126
00129 void SendParameters();
00130
00132
00139 bool Create1D(int numComps,
00140 vtkPixelBufferObject *pbo,
00141 bool shaderSupportsTextureInt);
00143
00145
00148 bool Create2D(unsigned int width, unsigned int height, int numComps,
00149 vtkPixelBufferObject *pbo,
00150 bool shaderSupportsTextureInt);
00152
00154
00157 bool Create3D(unsigned int width, unsigned int height, unsigned int depth,
00158 int numComps, vtkPixelBufferObject *pbo,
00159 bool shaderSupportsTextureInt);
00161
00162
00164
00167 bool Create2D(unsigned int width, unsigned int height, int numComps,
00168 int vtktype,
00169 bool shaderSupportsTextureInt);
00170 bool Create3D(unsigned int width, unsigned int height, unsigned int depth,
00171 int numComps, int vtktype,
00172 bool shaderSupportsTextureInt);
00174
00179 vtkPixelBufferObject* Download();
00180
00182 int GetDataType();
00183
00184 int GetInternalFormat(int vtktype, int numComps,
00185 bool shaderSupportsTextureInt);
00186 int GetFormat(int vtktype, int numComps,
00187 bool shaderSupportsTextureInt);
00188
00190
00193 vtkGetMacro(WrapS,int);
00194 vtkSetMacro(WrapS,int);
00196
00198
00201 vtkGetMacro(WrapT,int);
00202 vtkSetMacro(WrapT,int);
00204
00206
00209 vtkGetMacro(WrapR,int);
00210 vtkSetMacro(WrapR,int);
00212
00214
00219 vtkGetMacro(MinificationFilter,int);
00220 vtkSetMacro(MinificationFilter,int);
00222
00224
00226 vtkGetMacro(LinearMagnification,bool);
00227 vtkSetMacro(LinearMagnification,bool);
00229
00231
00233 vtkSetVector4Macro(BorderColor,float);
00234 vtkGetVector4Macro(BorderColor,float);
00236
00238
00241 vtkSetMacro(Priority,float);
00242 vtkGetMacro(Priority,float);
00244
00246
00248 vtkSetMacro(MinLOD,float);
00249 vtkGetMacro(MinLOD,float);
00251
00253
00255 vtkSetMacro(MaxLOD,float);
00256 vtkGetMacro(MaxLOD,float);
00258
00260
00263 vtkSetMacro(BaseLevel,int);
00264 vtkGetMacro(BaseLevel,int);
00266
00268
00271 vtkSetMacro(MaxLevel,int);
00272 vtkGetMacro(MaxLevel,int);
00274
00276
00282 vtkGetMacro(DepthTextureCompare,bool);
00283 vtkSetMacro(DepthTextureCompare,bool);
00285
00287
00297 vtkGetMacro(DepthTextureCompareFunction,int);
00298 vtkSetMacro(DepthTextureCompareFunction,int);
00300
00302
00307 vtkGetMacro(DepthTextureMode,int);
00308 vtkSetMacro(DepthTextureMode,int);
00310
00312
00314 vtkGetMacro(GenerateMipmap,bool);
00315 vtkSetMacro(GenerateMipmap,bool);
00317
00319 static bool IsSupported(vtkRenderWindow* renWin);
00320
00321 protected:
00322 vtkTextureObject();
00323 ~vtkTextureObject();
00324
00326 bool LoadRequiredExtensions(vtkOpenGLExtensionManager*);
00327
00329 void CreateTexture();
00330
00332 void DestroyTexture();
00333
00334 int NumberOfDimensions;
00335 unsigned int Width;
00336 unsigned int Height;
00337 unsigned int Depth;
00338
00339 int Target;
00340 int Format;
00341 int Type;
00342 int Components;
00343
00344 vtkWeakPointer<vtkRenderWindow> Context;
00345 unsigned int Handle;
00346 bool SupportsTextureInteger;
00347
00348 int WrapS;
00349 int WrapT;
00350 int WrapR;
00351 int MinificationFilter;
00352 bool LinearMagnification;
00353 float BorderColor[4];
00354
00355 float Priority;
00356 float MinLOD;
00357 float MaxLOD;
00358 int BaseLevel;
00359 int MaxLevel;
00360
00361
00362 bool DepthTextureCompare;
00363 int DepthTextureCompareFunction;
00364 int DepthTextureMode;
00365
00366 bool GenerateMipmap;
00367
00368 vtkTimeStamp SendParametersTime;
00369
00370 private:
00371 vtkTextureObject(const vtkTextureObject&);
00372 void operator=(const vtkTextureObject&);
00373
00374 };
00375
00376 #endif
00377
00378