00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGLSLShaderProgram.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 =========================================================================*/ 00015 /* 00016 * Copyright 2003 Sandia Corporation. 00017 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00018 * license for use of this work by or on behalf of the 00019 * U.S. Government. Redistribution and use in source and binary forms, with 00020 * or without modification, are permitted provided that this Notice and any 00021 * statement of authorship are reproduced on all copies. 00022 */ 00023 00038 #ifndef __vtkGLSLShaderProgram_h 00039 #define __vtkGLSLShaderProgram_h 00040 00041 #include "vtkShaderProgram.h" 00042 00043 class vtkGLSLShader; 00044 class vtkXMLDataElement; 00045 class vtkRenderWindow; 00046 00047 class VTK_RENDERING_EXPORT vtkGLSLShaderProgram : public vtkShaderProgram 00048 { 00049 public: 00050 vtkTypeMacro(vtkGLSLShaderProgram, vtkShaderProgram); 00051 static vtkGLSLShaderProgram *New(); 00052 void PrintSelf(ostream &os, vtkIndent indent); 00053 00054 // .Description: 00055 // Take shader from its source (file and/or string) and load, compile, and 00056 // install in hardware. Also, initialize uniform variables originating from 00057 // the following sources: XML material file, vtkProperty, vtkLight, 00058 // vtkCamera, and application-specified uniform variables. 00059 virtual void Render(vtkActor *actor, vtkRenderer *renderer); 00060 00062 virtual void PostRender(vtkActor*, vtkRenderer*); 00063 00067 virtual void ReleaseGraphicsResources(vtkWindow *); 00068 00070 00071 unsigned int GetProgram() 00072 {return this->Program;} 00074 00075 protected: 00076 vtkGLSLShaderProgram(); 00077 virtual ~vtkGLSLShaderProgram(); 00078 00080 virtual vtkShader* NewShader(); 00081 00082 virtual void LoadExtensions(vtkRenderWindow*); 00083 00084 unsigned int Program; 00085 int IsProgram(); 00086 int IsLinked(); 00087 int IsAttached(vtkGLSLShader* shader); 00088 virtual void Link(); 00089 00090 vtkSetStringMacro( Info ); 00091 vtkGetStringMacro( Info ); 00092 char* Info; 00093 void GetProgramInfo(); 00094 void GetInfoLog(); 00095 00096 private: 00097 vtkGLSLShaderProgram(const vtkGLSLShaderProgram&); // Not Implemented 00098 void operator=(const vtkGLSLShaderProgram&); // Not Implemented 00099 }; 00100 #endif //__vtkGLSLShaderProgram_h