33 #ifdef G4VIS_BUILD_OPENGL_DRIVER
35 #ifndef G4OPENGLVIEWER_HH
36 #define G4OPENGLVIEWER_HH
41 class G4OpenGLSceneHandler;
44 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
49 class G4OpenGLViewer:
virtual public G4VViewer {
51 friend class G4OpenGLSceneHandler;
52 friend class G4OpenGLImmediateSceneHandler;
53 friend class G4OpenGLStoredSceneHandler;
54 friend class G4OpenGLFileSceneHandler;
63 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
64 inline G4OpenGLWtDrawer* getWtDrawer() {
return fWtDrawer;}
67 void setWtDrawer(G4OpenGLWtDrawer* drawer);
68 G4OpenGLWtDrawer* fWtDrawer;
72 G4OpenGLViewer (G4OpenGLSceneHandler& scene);
73 virtual ~G4OpenGLViewer ();
76 G4OpenGLViewer(
const G4OpenGLViewer&);
77 G4OpenGLViewer& operator= (
const G4OpenGLViewer&);
83 virtual void DrawText(
const G4Text&);
86 void HaloingFirstPass ();
87 void HaloingSecondPass ();
89 void HLRSecondPass ();
91 void InitializeGLView ();
93 void ResizeWindow(
unsigned int,
unsigned int);
94 void Pick(GLdouble x, GLdouble y);
95 virtual void CreateFontLists () {}
108 std::string getRealPrintFilename();
109 unsigned int getWinWidth()
const;
110 unsigned int getWinHeight()
const;
113 GLdouble getSceneNearWidth();
114 GLdouble getSceneFarWidth();
115 GLdouble getSceneDepth();
120 G4OpenGLSceneHandler& fOpenGLSceneHandler;
123 transparency_enabled,
124 antialiasing_enabled,
129 G4double fDisplayHeadTimeX, fDisplayHeadTimeY;
131 G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
132 G4bool fDisplayLightFront;
133 G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
135 G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
142 #ifdef G4OPENGL_VERSION_2
144 std::string vertexShader_;
145 std::string fragmentShader_;
149 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
150 #define Shader Wt::WGLWidget::Shader
152 #define Shader GLuint
156 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
157 Wt::WGLWidget::Program shaderProgram_;
160 Wt::WGLWidget::AttribLocation vertexPositionAttribute_;
161 Wt::WGLWidget::AttribLocation vertexNormalAttribute_;
162 Wt::WGLWidget::UniformLocation pMatrixUniform_;
163 Wt::WGLWidget::UniformLocation cMatrixUniform_;
164 Wt::WGLWidget::UniformLocation mvMatrixUniform_;
165 Wt::WGLWidget::UniformLocation nMatrixUniform_;
166 Wt::WGLWidget::UniformLocation tMatrixUniform_;
168 GLuint shaderProgram_;
171 GLuint vertexPositionAttribute_;
172 GLuint vertexNormalAttribute_;
173 GLuint pMatrixUniform_;
174 GLuint cMatrixUniform_;
175 GLuint mvMatrixUniform_;
176 GLuint nMatrixUniform_;
177 GLuint tMatrixUniform_;
183 static G4int fPrintSizeX;
184 static G4int fPrintSizeY;
186 static int fPrintFilenameIndex;
187 unsigned int fWinSize_x, fWinSize_y;
190 int fGl2psDefaultLineWith;
191 int fGl2psDefaultPointSize;
197 G4int getRealPrintSizeX();
198 G4int getRealPrintSizeY();
199 GLubyte* grabPixels (
int inColor,
201 unsigned int height);
202 bool printNonVectoredEPS ();
205 bool printVectoredEPS();
virtual void ClearView()=0