00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTextureUnitManager.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00029 #ifndef __vtkTextureUnitManager_h 00030 #define __vtkTextureUnitManager_h 00031 00032 #include "vtkObject.h" 00033 00034 class vtkOpenGLRenderWindow; 00035 00036 class VTK_RENDERING_EXPORT vtkTextureUnitManager : public vtkObject 00037 { 00038 public: 00039 vtkTypeRevisionMacro(vtkTextureUnitManager,vtkObject); 00040 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00043 static vtkTextureUnitManager *New(); 00044 00046 00050 void SetContext(vtkOpenGLRenderWindow *context); 00051 vtkGetObjectMacro(Context,vtkOpenGLRenderWindow); 00053 00055 int GetNumberOfTextureUnits(); 00056 00062 virtual int Allocate(); 00063 00067 bool IsAllocated(int textureUnitId); 00068 00072 virtual void Free(int textureUnitId); 00073 00074 protected: 00076 vtkTextureUnitManager(); 00077 00079 ~vtkTextureUnitManager(); 00080 00083 void DeleteTable(); 00084 00085 vtkOpenGLRenderWindow *Context; 00086 00087 int NumberOfTextureUnits; 00088 bool *TextureUnits; 00089 00090 private: 00091 vtkTextureUnitManager(const vtkTextureUnitManager&); // Not implemented. 00092 void operator=(const vtkTextureUnitManager&); // Not implemented. 00093 }; 00094 00095 #endif