VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL2/vtkShader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004 
00005   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00020 #ifndef vtkShader_h
00021 #define vtkShader_h
00022 
00023 #include "vtkRenderingOpenGL2Module.h" // for export macro
00024 #include "vtkObject.h"
00025 
00026 #include <string> // For member variables.
00027 
00035 class VTKRENDERINGOPENGL2_EXPORT vtkShader : public vtkObject
00036 {
00037 public:
00038   static vtkShader *New();
00039   vtkTypeMacro(vtkShader, vtkObject);
00040   void PrintSelf(ostream& os, vtkIndent indent);
00041 
00042 
00044   enum Type {
00045     Vertex,    
00046     Fragment,  
00047     Geometry,  
00048     Unknown    
00049   };
00050 
00052   void SetType(Type type);
00053 
00055   Type GetType() const { return ShaderType; }
00056 
00058   void SetSource(const std::string &source);
00059 
00061   std::string GetSource() const { return Source; }
00062 
00064   std::string GetError() const { return Error; }
00065 
00067   int GetHandle() const { return Handle; }
00068 
00072   bool Compile();
00073 
00078   void Cleanup();
00079 
00080 protected:
00081   vtkShader();
00082   ~vtkShader();
00083 
00084   Type ShaderType;
00085   int  Handle;
00086   bool Dirty;
00087 
00088   std::string Source;
00089   std::string Error;
00090 
00091 private:
00092   vtkShader(const vtkShader&);  // Not implemented.
00093   void operator=(const vtkShader&);  // Not implemented.
00094 };
00095 
00096 
00097 #endif