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:
42  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
43 
47  void Render(vtkActor *a, vtkRenderer *ren);
48 
53 
59  virtual void PostRender(vtkActor *a,
60  vtkRenderer *r);
61 
67  virtual void ReleaseGraphicsResources(vtkWindow *win);
68 
70 
74  vtkGetObjectMacro(PropProgram, 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 
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
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
adapter to pass generic vertex attributes to the rendering pipeline to be used in a vtkShaderProgram2...
a simple class to control print indentation
Definition: vtkIndent.h:40
OpenGL property.
void BackfaceRender(vtkActor *a, vtkRenderer *ren)
Implement base class method.
void Render(vtkActor *a, vtkRenderer *ren)
Implement base class method.
virtual void AddShaderVariable(const char *name, int numVars, int *x)
Provide values to initialize shader variables.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetPropProgram(vtkShaderProgram2 *)
vtkShaderProgram2 * CurrentShaderProgram2
vtkShaderProgram2 * LastPropProgram
vtkShader2 * DefaultMainVS
vtkShader2 * DefaultPropVS
static vtkOpenGLProperty * New()
vtkShaderProgram2 * PropProgram
virtual void AddShaderVariable(const char *name, int numVars, double *x)
vtkShaderProgram2 * CachedShaderProgram2
virtual void PostRender(vtkActor *a, vtkRenderer *r)
This method is called after the actor has been rendered.
virtual void AddShaderVariable(const char *name, int numVars, float *x)
vtkShaderProgram2 * LastRendererShaderProgram2
bool RenderTextures(vtkActor *actor, vtkRenderer *renderer, bool using_shader_program2)
Method called in vtkOpenGLProperty::Render() to render textures.
vtkShader2 * DefaultPropFS
vtkGLSLShaderDeviceAdapter2 * ShaderDeviceAdapter2
bool RenderShaders(vtkActor *actor, vtkRenderer *renderer)
Method called in vtkOpenGLProperty::Render() to render shaders and/or related entities like shader va...
virtual vtkShaderDeviceAdapter2 * GetShaderDeviceAdapter2()
Get the object that can pass vertex attribute to a vtkShaderProgram2.
vtkShader2 * DefaultMainFS
virtual void ReleaseGraphicsResources(vtkWindow *win)
Release any graphics resources that are being consumed by this property.
void LoadMultiTexturingExtensions(vtkRenderer *ren)
Load OpenGL extensions for multi texturing.
static void SetMaterialProperties(unsigned int face, double ambient, const double ambient_color[3], double diffuse, const double diffuse_color[3], double specular, const double specular_color[3], double specular_power, double opacity, vtkOpenGLRenderWindow *context)
Helper method to set OpenGL material properties.
OpenGL rendering window.
OpenGL renderer.
represent surface properties of a geometric object
Definition: vtkProperty.h:65
abstract specification for renderers
Definition: vtkRenderer.h:64
a list of Shader2 objects.
GLSL Shader.
Definition: vtkShader2.h:63
an adapter to pass generic vertex attributes to the rendering pipeline.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ name
Definition: vtkX3D.h:219