VTK
vtkOpenGLProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLProperty.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 =========================================================================*/
22 #ifndef vtkOpenGLProperty_h
23 #define vtkOpenGLProperty_h
24 
25 #include "vtkRenderingOpenGLModule.h" // For export macro
26 #include "vtkProperty.h"
27 
29 class vtkOpenGLRenderer;
31 class vtkShader2;
34 class vtkShaderProgram2;
35 
36 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLProperty : public vtkProperty
37 {
38 public:
39  static vtkOpenGLProperty *New();
41  virtual void PrintSelf(ostream& os, vtkIndent indent);
42 
44  void Render(vtkActor *a, vtkRenderer *ren);
45 
47  void BackfaceRender(vtkActor *a, vtkRenderer *ren);
48 
49  //BTX
51 
53  virtual void PostRender(vtkActor *a,
54  vtkRenderer *r);
56 
60  virtual void ReleaseGraphicsResources(vtkWindow *win);
61 
63 
65  vtkGetObjectMacro(PropProgram, vtkShaderProgram2);
66  void SetPropProgram(vtkShaderProgram2 *);
68 
71 
73 
74  vtkGetObjectMacro(CurrentShaderProgram2, vtkShaderProgram2);
75  //ETX
77 
79 
83  virtual void AddShaderVariable(const char *name, int numVars, int *x);
84  virtual void AddShaderVariable(const char *name, int numVars, float *x);
85  virtual void AddShaderVariable(const char *name, int numVars, double *x);
87 
89 
90  static void SetMaterialProperties(unsigned int face,
91  double ambient, const double ambient_color[3],
92  double diffuse, const double diffuse_color[3],
93  double specular, const double specular_color[3], double specular_power,
94  double opacity, vtkOpenGLRenderWindow* context);
96 
97 protected:
100 
104  bool RenderShaders(vtkActor* actor, vtkRenderer* renderer);
105 
107 
109  bool RenderTextures(vtkActor* actor, vtkRenderer* renderer,
110  bool using_shader_program2);
112 
114  void LoadMultiTexturingExtensions(vtkRenderer* ren);
115 
116  // Owned. Result of merging the shader program of the renderer
117  // and the PropProgram.
119 
123 
124  // Point to CachedShaderProgram2 if Shading is on and the context
125  // supports it.
127 
137 
138 private:
139  vtkOpenGLProperty(const vtkOpenGLProperty&); // Not implemented.
140  void operator=(const vtkOpenGLProperty&); // Not implemented.
141 };
142 
143 #endif
OpenGL rendering window.
GLSL Shader.
Definition: vtkShader2.h:61
vtkShaderProgram2 * LastPropProgram
virtual void Render(vtkActor *, vtkRenderer *)
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
static vtkProperty * New()
vtkGLSLShaderDeviceAdapter2 * ShaderDeviceAdapter2
vtkShader2 * DefaultPropFS
vtkShader2 * DefaultMainVS
represent surface properties of a geometric object
Definition: vtkProperty.h:63
virtual void AddShaderVariable(const char *name, int numVars, int *x)
vtkShader2 * DefaultPropVS
abstract specification for renderers
Definition: vtkRenderer.h:62
OpenGL property.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
a list of Shader2 objects.
void PrintSelf(ostream &os, vtkIndent indent)
GLSL Program.
vtkShaderProgram2 * PropProgram
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkShader2 * DefaultMainFS
vtkShaderProgram2 * CachedShaderProgram2
virtual vtkShaderDeviceAdapter2 * GetShaderDeviceAdapter2()
Definition: vtkProperty.h:275
vtkShaderProgram2 * LastRendererShaderProgram2
virtual void PostRender(vtkActor *, vtkRenderer *)
vtkShaderProgram2 * CurrentShaderProgram2
virtual void BackfaceRender(vtkActor *, vtkRenderer *)
Definition: vtkProperty.h:91
adapter to pass generic vertex attributes to the rendering pipeline to be used in a vtkShaderProgram2...
virtual void ReleaseGraphicsResources(vtkWindow *win)
an adapter to pass generic vertex attributes to the rendering pipeline. .SECTION This class is an ada...
OpenGL renderer.