VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLGL2PSHelper.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00032 #ifndef __vtkOpenGLGL2PSHelper_h 00033 #define __vtkOpenGLGL2PSHelper_h 00034 00035 #include "vtkRenderingOpenGLModule.h" // For export macro 00036 #include "vtkOpenGL.h" // for GL defines. 00037 00038 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLGL2PSHelper 00039 { 00040 public: 00041 00043 00044 static void SetLineWidth(float lineWidth) 00045 { 00046 if (vtkOpenGLGL2PSHelper::InGL2PSRender) 00047 { 00048 glPassThrough(vtkOpenGLGL2PSHelper::LineWidthToken); 00049 glPassThrough(vtkOpenGLGL2PSHelper::LineWidthFactor * lineWidth); 00050 } 00051 } 00053 00055 00056 static void SetPointSize(float pointSize) 00057 { 00058 if (vtkOpenGLGL2PSHelper::InGL2PSRender) 00059 { 00060 glPassThrough(vtkOpenGLGL2PSHelper::PointSizeToken); 00061 glPassThrough(vtkOpenGLGL2PSHelper::PointSizeFactor * pointSize); 00062 } 00063 } 00065 00067 00070 static void EnableStipple() 00071 { 00072 if (vtkOpenGLGL2PSHelper::InGL2PSRender) 00073 { 00074 GLint tmp; 00075 glPassThrough(vtkOpenGLGL2PSHelper::StippleBeginToken); 00076 glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp); 00077 glPassThrough(static_cast<GLfloat>(tmp)); 00078 glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp); 00079 glPassThrough(static_cast<GLfloat>(tmp)); 00080 } 00081 } 00083 00085 00087 static void DisableStipple() 00088 { 00089 if (vtkOpenGLGL2PSHelper::InGL2PSRender) 00090 { 00091 glPassThrough(vtkOpenGLGL2PSHelper::StippleEndToken); 00092 } 00093 } 00095 00096 00097 protected: 00098 friend class vtkGL2PSUtilities; 00099 00100 static bool InGL2PSRender; 00101 static GLfloat PointSizeFactor; 00102 static GLfloat LineWidthFactor; 00103 static GLfloat PointSizeToken; 00104 static GLfloat LineWidthToken; 00105 static GLfloat StippleBeginToken; 00106 static GLfloat StippleEndToken; 00107 00108 private: 00109 // static-only class -- no need to construct/destroy. 00110 vtkOpenGLGL2PSHelper(); 00111 ~vtkOpenGLGL2PSHelper(); 00112 vtkOpenGLGL2PSHelper(const vtkOpenGLGL2PSHelper &); // Not implemented. 00113 void operator=(const vtkOpenGLGL2PSHelper &); // Not implemented. 00114 }; 00115 00116 #endif //__vtkOpenGLGL2PSHelper_h 00117 // VTK-HeaderTest-Exclude: vtkOpenGLGL2PSHelper.h