VTK
vtkOpenGLContextDevice3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLContextDevice3D.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 =========================================================================*/
15 
24 #ifndef vtkOpenGLContextDevice3D_h
25 #define vtkOpenGLContextDevice3D_h
26 
27 #include "vtkRenderingContextOpenGL2Module.h" // For export macro
28 #include "vtkContextDevice3D.h"
29 #include "vtkNew.h" // For ivars.
30 #include <vector> // STL Header
31 
32 class vtkBrush;
34 class vtkOpenGLHelper;
36 class vtkPen;
37 class vtkRenderer;
38 class vtkShaderProgram;
39 class vtkTransform;
40 
41 class VTKRENDERINGCONTEXTOPENGL2_EXPORT vtkOpenGLContextDevice3D : public vtkContextDevice3D
42 {
43 public:
45  void PrintSelf(ostream &os, vtkIndent indent);
46 
48 
50  void DrawPoly(const float *verts, int n, const unsigned char *colors, int nc);
51 
53  void DrawLines(const float *verts, int n, const unsigned char *colors, int nc);
54 
56 
57  void DrawPoints(const float *verts, int n,
58  const unsigned char *colors, int nc);
60 
62 
63  void DrawTriangleMesh(const float *mesh, int n,
64  const unsigned char *colors, int nc);
66 
71  void ApplyPen(vtkPen *pen);
72 
77  void ApplyBrush(vtkBrush *brush);
78 
81 
84 
87 
89  void PushMatrix();
90 
92  void PopMatrix();
93 
96  void SetClipping(const vtkRecti &rect);
97 
99  void EnableClipping(bool enable);
100 
102 
107  void EnableClippingPlane(int i, double *planeEquation);
108  void DisableClippingPlane(int i);
110 
113 
115  virtual void Begin(vtkViewport* viewport);
116 
117 protected:
120 
122  virtual void EnableDepthBuffer();
123 
125  virtual void DisableDepthBuffer();
126 
127  vtkOpenGLHelper *VCBO; // vertex + color
129  vtkOpenGLHelper *VBO; // vertex
131 
134  const float *v, int nv,
135  const unsigned char *coolors, int nc,
136  float *tcoords);
137  void CoreDrawTriangles(std::vector<float> &tverts);
138 
139  // do we have wide lines that require special handling
140  virtual bool HaveWideLines();
141 
143 
146 
149 
150  std::vector<bool> ClippingPlaneStates;
151  std::vector<double> ClippingPlaneValues;
152 
153 private:
154  vtkOpenGLContextDevice3D(const vtkOpenGLContextDevice3D &); // Not implemented.
155  void operator=(const vtkOpenGLContextDevice3D &); // Not implemented.
156 
158 
159  class Private;
160  Private *Storage;
162 
163  // we need a pointer to this because only
164  // the 2D device gets a Begin and sets up
165  // the ortho matrix
166  vtkOpenGLContextDevice2D *Device2D;
167 
168  vtkNew<vtkBrush> Brush;
169  vtkNew<vtkPen> Pen;
170 };
171 
172 #endif
vtkBrush
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:37
vtkOpenGLContextDevice3D::Renderer
vtkRenderer * Renderer
Definition: vtkOpenGLContextDevice3D.h:148
vtkOpenGLContextDevice3D
OpenGL class drawing 3D primitives.
Definition: vtkOpenGLContextDevice3D.h:35
vtkOpenGLContextDevice3D::EnableClippingPlane
void EnableClippingPlane(int i, double *planeEquation)
vtkOpenGLContextDevice3D::PopMatrix
void PopMatrix()
vtkOpenGLContextDevice3D::DrawLines
void DrawLines(const float *verts, int n, const unsigned char *colors, int nc)
vtkgl::m
const GLfloat * m
Definition: vtkgl.h:18169
vtkOpenGLContextDevice3D::BuildVBO
void BuildVBO(vtkOpenGLHelper *cbo, const float *v, int nv, const unsigned char *coolors, int nc, float *tcoords)
vtkOpenGLContextDevice3D::ApplyBrush
void ApplyBrush(vtkBrush *brush)
vtkOpenGLContextDevice3D::ReadyVCBOProgram
void ReadyVCBOProgram()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkContextDevice3D
Abstract class for drawing 3D primitives.
Definition: vtkContextDevice3D.h:41
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkOpenGLContextDevice3D::VCBO
vtkOpenGLHelper * VCBO
Definition: vtkOpenGLContextDevice3D.h:127
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkOpenGLContextDevice3D::Initialize
void Initialize(vtkRenderer *, vtkOpenGLContextDevice2D *)
vtkgl::enable
GLboolean enable
Definition: vtkgl.h:18647
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkOpenGLContextDevice3D::ReadyVBOProgram
void ReadyVBOProgram()
vtkOpenGLContextDevice3D::ClippingPlaneValues
std::vector< double > ClippingPlaneValues
Definition: vtkOpenGLContextDevice3D.h:151
vtkOpenGLContextDevice3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkOpenGLContextDevice3D::ModelMatrix
vtkTransform * ModelMatrix
Definition: vtkOpenGLContextDevice3D.h:142
vtkOpenGLContextDevice3D::HaveWideLines
virtual bool HaveWideLines()
vtkOpenGLContextDevice3D::SetMatrix
void SetMatrix(vtkMatrix4x4 *m)
vtkOpenGLContextDevice2D
Class for drawing 2D primitives using OpenGL 1.1+.
Definition: vtkOpenGLContextDevice2D.h:48
vtkOpenGLContextDevice3D::CoreDrawTriangles
void CoreDrawTriangles(std::vector< float > &tverts)
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:43
vtkOpenGLContextDevice3D::DrawPoly
void DrawPoly(const float *verts, int n, const unsigned char *colors, int nc)
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:31
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:39
vtkOpenGLContextDevice3D::DrawPoints
void DrawPoints(const float *verts, int n, const unsigned char *colors, int nc)
vtkOpenGLContextDevice3D::~vtkOpenGLContextDevice3D
~vtkOpenGLContextDevice3D()
vtkContextDevice3D.h
vtkOpenGLContextDevice3D::EnableClipping
void EnableClipping(bool enable)
vtkOpenGLContextDevice3D::DrawTriangleMesh
void DrawTriangleMesh(const float *mesh, int n, const unsigned char *colors, int nc)
vtkNew< vtkBrush >
vtkOpenGLContextDevice3D::ApplyPen
void ApplyPen(vtkPen *pen)
vtkOpenGLContextDevice3D::GetMatrix
void GetMatrix(vtkMatrix4x4 *m)
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkOpenGLContextDevice3D::DisableDepthBuffer
virtual void DisableDepthBuffer()
vtkNew.h
vtkOpenGLContextDevice3D::Begin
virtual void Begin(vtkViewport *viewport)
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkOpenGLContextDevice3D::New
static vtkOpenGLContextDevice3D * New()
vtkOpenGLContextDevice3D::DisableClippingPlane
void DisableClippingPlane(int i)
vtkOpenGLContextDevice3D::RenderWindow
vtkOpenGLRenderWindow * RenderWindow
Definition: vtkOpenGLContextDevice3D.h:145
vtkOpenGLContextDevice3D::EnableDepthBuffer
virtual void EnableDepthBuffer()
vtkRecti
Definition: vtkRect.h:88
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:41
vtkOpenGLContextDevice3D::PushMatrix
void PushMatrix()
vtkPen
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:39
vtkOpenGLContextDevice3D::SetMatrices
void SetMatrices(vtkShaderProgram *prog)
vtkOpenGLContextDevice3D::vtkOpenGLContextDevice3D
vtkOpenGLContextDevice3D()
vtkOpenGLContextDevice3D::VBO
vtkOpenGLHelper * VBO
Definition: vtkOpenGLContextDevice3D.h:129
vtkOpenGLContextDevice3D::ClippingPlaneStates
std::vector< bool > ClippingPlaneStates
Definition: vtkOpenGLContextDevice3D.h:150
vtkOpenGLContextDevice3D::MultiplyMatrix
void MultiplyMatrix(vtkMatrix4x4 *m)
vtkOpenGLContextDevice3D::SetClipping
void SetClipping(const vtkRecti &rect)