VTK
vtkOpenGLGL2PSHelper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOpenGLGL2PSHelper.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
33#ifndef vtkOpenGLGL2PSHelper_h
34#define vtkOpenGLGL2PSHelper_h
35
36#include "vtkRenderingOpenGLModule.h" // For export macro
37#include "vtkOpenGL.h" // for GL defines.
38
39class VTKRENDERINGOPENGL_EXPORT vtkOpenGLGL2PSHelper
40{
41public:
42
44
47 static void SetLineWidth(float lineWidth)
48 {
50 {
52 glPassThrough(vtkOpenGLGL2PSHelper::LineWidthFactor * lineWidth);
53 }
54 }
56
58
61 static void SetPointSize(float pointSize)
62 {
64 {
66 glPassThrough(vtkOpenGLGL2PSHelper::PointSizeFactor * pointSize);
67 }
68 }
70
72
76 static void EnableStipple()
77 {
79 {
80 GLint tmp;
82 glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp);
83 glPassThrough(static_cast<GLfloat>(tmp));
84 glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp);
85 glPassThrough(static_cast<GLfloat>(tmp));
86 }
87 }
89
93 static void DisableStipple()
94 {
96 {
98 }
99 }
100
101
102protected:
103 friend class vtkGL2PSUtilities;
104
105 static bool InGL2PSRender;
106 static GLfloat PointSizeFactor;
107 static GLfloat LineWidthFactor;
108 static GLfloat PointSizeToken;
109 static GLfloat LineWidthToken;
110 static GLfloat StippleBeginToken;
111 static GLfloat StippleEndToken;
112
113private:
114 // static-only class -- no need to construct/destroy.
117 vtkOpenGLGL2PSHelper(const vtkOpenGLGL2PSHelper &) VTK_DELETE_FUNCTION;
118 void operator=(const vtkOpenGLGL2PSHelper &) VTK_DELETE_FUNCTION;
119};
120
121#endif //vtkOpenGLGL2PSHelper_h
122// VTK-HeaderTest-Exclude: vtkOpenGLGL2PSHelper.h
Helper functions for using GL2PS within VTK.
Helper functionality for GL2PS exporting.
static void SetLineWidth(float lineWidth)
Call alongside glLineWidth(lineWidth) to inform GL2PS of the change.
static GLfloat PointSizeFactor
static GLfloat StippleEndToken
static GLfloat LineWidthFactor
static GLfloat StippleBeginToken
static void DisableStipple()
Call alongside glDisable(GL_LINE_STIPPLE) to inform GL2PS of the change.
static void SetPointSize(float pointSize)
Call alongside glPointSize(pointSize) to inform GL2PS of the change.
static void EnableStipple()
Call alongside glEnable(GL_LINE_STIPPLE) to inform GL2PS of the change.