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
vtkProperty::New
static vtkProperty * New()
Construct object with object color, ambient color, diffuse color, specular color, and edge color whit...
vtkShaderDeviceAdapter2
an adapter to pass generic vertex attributes to the rendering pipeline. .SECTION This class is an ada...
Definition: vtkShaderDeviceAdapter2.h:34
vtkShader2Collection
a list of Shader2 objects.
Definition: vtkShader2Collection.h:35
vtkOpenGLProperty::UseDefaultPropFS
bool UseDefaultPropFS
Definition: vtkOpenGLProperty.h:155
vtkOpenGLProperty
OpenGL property.
Definition: vtkOpenGLProperty.h:37
vtkProperty::AddShaderVariable
virtual void AddShaderVariable(const char *name, int numVars, int *x)
Provide values to initialize shader variables.
vtkProperty::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkOpenGLProperty::DefaultMainVS
vtkShader2 * DefaultMainVS
Definition: vtkOpenGLProperty.h:148
vtkOpenGLProperty::CachedShaderProgram2
vtkShaderProgram2 * CachedShaderProgram2
Definition: vtkOpenGLProperty.h:138
vtkOpenGLProperty::LastRendererShaderProgram2
vtkShaderProgram2 * LastRendererShaderProgram2
Definition: vtkOpenGLProperty.h:140
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkOpenGLProperty::DefaultPropFS
vtkShader2 * DefaultPropFS
Definition: vtkOpenGLProperty.h:151
vtkOpenGLProperty::DefaultPropVS
vtkShader2 * DefaultPropVS
Definition: vtkOpenGLProperty.h:150
vtkOpenGLProperty::CurrentShaderProgram2
vtkShaderProgram2 * CurrentShaderProgram2
Definition: vtkOpenGLProperty.h:146
vtkProperty.h
vtkProperty::GetShaderDeviceAdapter2
virtual vtkShaderDeviceAdapter2 * GetShaderDeviceAdapter2()
Get the vtkShaderDeviceAdapter2 if set, returns null otherwise.
Definition: vtkProperty.h:351
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkOpenGLProperty::UseDefaultMainVS
bool UseDefaultMainVS
Definition: vtkOpenGLProperty.h:152
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkOpenGLRenderer
OpenGL renderer.
Definition: vtkOpenGLRenderer.h:36
vtkProperty::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *win)
Release any graphics resources that are being consumed by this property.
vtkOpenGLProperty::PropProgram
vtkShaderProgram2 * PropProgram
Definition: vtkOpenGLProperty.h:142
vtkProperty::BackfaceRender
virtual void BackfaceRender(vtkActor *, vtkRenderer *)
This method renders the property as a backface property.
Definition: vtkProperty.h:98
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkProperty::PostRender
virtual void PostRender(vtkActor *, vtkRenderer *)
This method is called after the actor has been rendered.
vtkGLSLShaderDeviceAdapter2
adapter to pass generic vertex attributes to the rendering pipeline to be used in a vtkShaderProgram2...
Definition: vtkGLSLShaderDeviceAdapter2.h:31
vtkOpenGLProperty::UseDefaultPropVS
bool UseDefaultPropVS
Definition: vtkOpenGLProperty.h:154
vtkOpenGLProperty::UseDefaultMainFS
bool UseDefaultMainFS
Definition: vtkOpenGLProperty.h:153
vtkShaderProgram2
GLSL Program.
Definition: vtkShaderProgram2.h:68
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkOpenGLProperty::LastPropProgram
vtkShaderProgram2 * LastPropProgram
Definition: vtkOpenGLProperty.h:141
vtkOpenGLProperty::DefaultMainFS
vtkShader2 * DefaultMainFS
Definition: vtkOpenGLProperty.h:149
vtkShader2
GLSL Shader.
Definition: vtkShader2.h:62
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:41
vtkOpenGLProperty::ShaderDeviceAdapter2
vtkGLSLShaderDeviceAdapter2 * ShaderDeviceAdapter2
Definition: vtkOpenGLProperty.h:156
vtkProperty::Render
virtual void Render(vtkActor *, vtkRenderer *)
This method causes the property to set up whatever is required for its instance variables.