VTK
dox/Rendering/OpenGL/vtkGLSLShaderProgram.h
Go to the documentation of this file.
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 "vtkRenderingOpenGLModule.h" // For export macro
00042 #include "vtkShaderProgram.h"
00043 
00044 class vtkGLSLShader;
00045 class vtkXMLDataElement;
00046 class vtkRenderWindow;
00047 
00048 class VTKRENDERINGOPENGL_EXPORT vtkGLSLShaderProgram : public vtkShaderProgram
00049 {
00050 public:
00051   vtkTypeMacro(vtkGLSLShaderProgram, vtkShaderProgram);
00052   static vtkGLSLShaderProgram *New();
00053   void PrintSelf(ostream &os, vtkIndent indent);
00054 
00055   // .Description:
00056   // Take shader from its source (file and/or string) and load, compile, and
00057   // install in hardware. Also, initialize uniform variables originating from
00058   // the following sources: XML material file, vtkProperty, vtkLight,
00059   // vtkCamera, and application-specified uniform variables.
00060   virtual void Render(vtkActor *actor, vtkRenderer *renderer);
00061 
00063   virtual void PostRender(vtkActor*, vtkRenderer*);
00064 
00068   virtual void ReleaseGraphicsResources(vtkWindow *);
00069 
00071 
00072   unsigned int GetProgram()
00073     {return this->Program;}
00075 
00076 protected:
00077   vtkGLSLShaderProgram();
00078   virtual ~vtkGLSLShaderProgram();
00079 
00081   virtual vtkShader* NewShader();
00082 
00083   virtual void LoadExtensions(vtkRenderWindow*);
00084 
00085   unsigned int Program;
00086   int IsProgram();
00087   int IsLinked();
00088   int IsAttached(vtkGLSLShader* shader);
00089   virtual void Link();
00090 
00091   vtkSetStringMacro( Info );
00092   vtkGetStringMacro( Info );
00093   char* Info;
00094   void GetProgramInfo();
00095   void GetInfoLog();
00096 
00097 private:
00098   vtkGLSLShaderProgram(const vtkGLSLShaderProgram&); // Not Implemented
00099   void operator=(const vtkGLSLShaderProgram&); // Not Implemented
00100 };
00101 #endif //__vtkGLSLShaderProgram_h