VTK
vtkGLSLShaderProgram.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGLSLShaderProgram.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 =========================================================================*/
15 /*
16  * Copyright 2003 Sandia Corporation.
17  * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
18  * license for use of this work by or on behalf of the
19  * U.S. Government. Redistribution and use in source and binary forms, with
20  * or without modification, are permitted provided that this Notice and any
21  * statement of authorship are reproduced on all copies.
22  */
23 
38 #ifndef __vtkGLSLShaderProgram_h
39 #define __vtkGLSLShaderProgram_h
40 
41 #include "vtkRenderingOpenGLModule.h" // For export macro
42 #include "vtkShaderProgram.h"
43 
44 class vtkGLSLShader;
45 class vtkXMLDataElement;
46 class vtkRenderWindow;
47 
48 class VTKRENDERINGOPENGL_EXPORT vtkGLSLShaderProgram : public vtkShaderProgram
49 {
50 public:
52  static vtkGLSLShaderProgram *New();
53  void PrintSelf(ostream &os, vtkIndent indent);
54 
55  // .Description:
56  // Take shader from its source (file and/or string) and load, compile, and
57  // install in hardware. Also, initialize uniform variables originating from
58  // the following sources: XML material file, vtkProperty, vtkLight,
59  // vtkCamera, and application-specified uniform variables.
60  virtual void Render(vtkActor *actor, vtkRenderer *renderer);
61 
63  virtual void PostRender(vtkActor*, vtkRenderer*);
64 
68  virtual void ReleaseGraphicsResources(vtkWindow *);
69 
71 
72  unsigned int GetProgram()
73  {return this->Program;}
75 
76 protected:
78  virtual ~vtkGLSLShaderProgram();
79 
81  virtual vtkShader* NewShader();
82 
83  virtual void LoadExtensions(vtkRenderWindow*);
84 
85  unsigned int Program;
86  int IsProgram();
87  int IsLinked();
88  int IsAttached(vtkGLSLShader* shader);
89  virtual void Link();
90 
91  vtkSetStringMacro( Info );
93  char* Info;
94  void GetProgramInfo();
95  void GetInfoLog();
96 
97 private:
98  vtkGLSLShaderProgram(const vtkGLSLShaderProgram&); // Not Implemented
99  void operator=(const vtkGLSLShaderProgram&); // Not Implemented
100 };
101 #endif //__vtkGLSLShaderProgram_h