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 =========================================================================*/
23 #ifndef vtkOpenGLProperty_h
24 #define vtkOpenGLProperty_h
25 
26 #include "vtkRenderingOpenGLModule.h" // For export macro
27 #include "vtkProperty.h"
28 
30 class vtkOpenGLRenderer;
32 class vtkShader2;
35 class vtkShaderProgram2;
36 
37 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLProperty : public vtkProperty
38 {
39 public:
40  static vtkOpenGLProperty *New();
42  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
43 
47  void Render(vtkActor *a, vtkRenderer *ren);
48 
52  void BackfaceRender(vtkActor *a, vtkRenderer *ren);
53 
59  virtual void PostRender(vtkActor *a,
60  vtkRenderer *r);
61 
67  virtual void ReleaseGraphicsResources(vtkWindow *win);
68 
70 
74  vtkGetObjectMacro(PropProgram, vtkShaderProgram2);
75  void SetPropProgram(vtkShaderProgram2 *);
77 
82 
84 
87  vtkGetObjectMacro(CurrentShaderProgram2, vtkShaderProgram2);
89 
91 
99  virtual void AddShaderVariable(const char *name, int numVars, int *x);
100  virtual void AddShaderVariable(const char *name, int numVars, float *x);
101  virtual void AddShaderVariable(const char *name, int numVars, double *x);
103 
107  static void SetMaterialProperties(unsigned int face,
108  double ambient, const double ambient_color[3],
109  double diffuse, const double diffuse_color[3],
110  double specular, const double specular_color[3], double specular_power,
111  double opacity, vtkOpenGLRenderWindow* context);
112 
113 protected:
116 
122  bool RenderShaders(vtkActor* actor, vtkRenderer* renderer);
123 
128  bool RenderTextures(vtkActor* actor, vtkRenderer* renderer,
129  bool using_shader_program2);
130 
134  void LoadMultiTexturingExtensions(vtkRenderer* ren);
135 
136  // Owned. Result of merging the shader program of the renderer
137  // and the PropProgram.
139 
143 
144  // Point to CachedShaderProgram2 if Shading is on and the context
145  // supports it.
147 
157 
158 private:
159  vtkOpenGLProperty(const vtkOpenGLProperty&) VTK_DELETE_FUNCTION;
160  void operator=(const vtkOpenGLProperty&) VTK_DELETE_FUNCTION;
161 };
162 
163 #endif
OpenGL rendering window.
GLSL Shader.
Definition: vtkShader2.h:62
vtkShaderProgram2 * LastPropProgram
virtual void Render(vtkActor *, vtkRenderer *)
This method causes the property to set up whatever is required for its instance variables.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
static vtkProperty * New()
Construct object with object color, ambient color, diffuse color, specular color, and edge color whit...
vtkGLSLShaderDeviceAdapter2 * ShaderDeviceAdapter2
vtkShader2 * DefaultPropFS
vtkShader2 * DefaultMainVS
represent surface properties of a geometric object
Definition: vtkProperty.h:64
virtual void AddShaderVariable(const char *name, int numVars, int *x)
Provide values to initialize shader variables.
vtkShader2 * DefaultPropVS
abstract specification for renderers
Definition: vtkRenderer.h:63
OpenGL property.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a list of Shader2 objects.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
GLSL Program.
vtkShaderProgram2 * PropProgram
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkShader2 * DefaultMainFS
vtkShaderProgram2 * CachedShaderProgram2
virtual vtkShaderDeviceAdapter2 * GetShaderDeviceAdapter2()
Get the vtkShaderDeviceAdapter2 if set, returns null otherwise.
Definition: vtkProperty.h:351
vtkShaderProgram2 * LastRendererShaderProgram2
virtual void PostRender(vtkActor *, vtkRenderer *)
This method is called after the actor has been rendered.
vtkShaderProgram2 * CurrentShaderProgram2
virtual void BackfaceRender(vtkActor *, vtkRenderer *)
This method renders the property as a backface property.
Definition: vtkProperty.h:98
adapter to pass generic vertex attributes to the rendering pipeline to be used in a vtkShaderProgram2...
virtual void ReleaseGraphicsResources(vtkWindow *win)
Release any graphics resources that are being consumed by this property.
an adapter to pass generic vertex attributes to the rendering pipeline.
OpenGL renderer.