VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLTexture.h 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 =========================================================================*/ 00021 #ifndef vtkOpenGLShaderCache_h 00022 #define vtkOpenGLShaderCache_h 00023 00024 #include "vtkRenderingOpenGL2Module.h" // For export macro 00025 #include "vtkObject.h" 00026 00027 class vtkShader; 00028 class vtkShaderProgram; 00029 class vtkWindow; 00030 00031 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLShaderCache : public vtkObject 00032 { 00033 public: 00034 static vtkOpenGLShaderCache *New(); 00035 vtkTypeMacro(vtkOpenGLShaderCache, vtkObject); 00036 virtual void PrintSelf(ostream& os, vtkIndent indent); 00037 00038 // make sure the specified shader is compiled, linked, and bound 00039 virtual vtkShaderProgram *ReadyShader(const char *vertexCode, 00040 const char *fragmentCode, 00041 const char *geometryCode); 00042 virtual vtkShaderProgram *ReadyShader(vtkShaderProgram *shader); 00043 00047 void ReleaseCurrentShader(); 00048 00050 virtual void ReleaseGraphicsResources(vtkWindow *win); 00051 00053 00055 virtual void ClearLastShaderBound() { this->LastShaderBound = NULL; } 00056 vtkGetObjectMacro(LastShaderBound, vtkShaderProgram); 00058 00059 protected: 00060 vtkOpenGLShaderCache(); 00061 ~vtkOpenGLShaderCache(); 00062 00063 virtual vtkShaderProgram* GetShader(const char *vertexCode, 00064 const char *fragmentCode, 00065 const char *geometryCode); 00066 virtual int BindShader(vtkShaderProgram* shader); 00067 00068 class Private; 00069 Private *Internal; 00070 vtkShaderProgram *LastShaderBound; 00071 00072 private: 00073 vtkOpenGLShaderCache(const vtkOpenGLShaderCache&); // Not implemented. 00074 void operator=(const vtkOpenGLShaderCache&); // Not implemented. 00075 00076 }; 00077 00078 #endif