VTK
vtkOpenGLShaderCache.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLTexture.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
21 #ifndef vtkOpenGLShaderCache_h
22 #define vtkOpenGLShaderCache_h
23 
24 #include "vtkRenderingOpenGL2Module.h" // For export macro
25 #include "vtkObject.h"
26 
27 class vtkShader;
28 class vtkShaderProgram;
29 class vtkWindow;
30 
31 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLShaderCache : public vtkObject
32 {
33 public:
34  static vtkOpenGLShaderCache *New();
36  virtual void PrintSelf(ostream& os, vtkIndent indent);
37 
38  // make sure the specified shader is compiled, linked, and bound
39  virtual vtkShaderProgram *ReadyShader(const char *vertexCode,
40  const char *fragmentCode,
41  const char *geometryCode);
42  virtual vtkShaderProgram *ReadyShader(vtkShaderProgram *shader);
43 
47  void ReleaseCurrentShader();
48 
50  virtual void ReleaseGraphicsResources(vtkWindow *win);
51 
53 
55  virtual void ClearLastShaderBound() { this->LastShaderBound = NULL; }
56  vtkGetObjectMacro(LastShaderBound, vtkShaderProgram);
58 
59 protected:
62 
63  virtual vtkShaderProgram* GetShader(const char *vertexCode,
64  const char *fragmentCode,
65  const char *geometryCode);
66  virtual int BindShader(vtkShaderProgram* shader);
67 
68  class Private;
69  Private *Internal;
71 
72 private:
73  vtkOpenGLShaderCache(const vtkOpenGLShaderCache&); // Not implemented.
74  void operator=(const vtkOpenGLShaderCache&); // Not implemented.
75 
76 };
77 
78 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
manage Shader Programs within a context
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
GLuint shader
Definition: vtkgl.h:11982
virtual void ClearLastShaderBound()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
vtkShaderProgram * LastShaderBound
Vertex or Fragment shader, combined into a ShaderProgram.
Definition: vtkShader.h:35
static vtkObject * New()
The ShaderProgram uses one or more Shader objects.