Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // << 26 // 7 // >> 8 // $Id: G4OpenGLXmViewer.cc,v 1.3 1999/12/15 14:54:11 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-01-01 $ 27 // 10 // 28 // 11 // 29 // Andrew Walkden 10th February 1997 12 // Andrew Walkden 10th February 1997 30 // G4OpenGLXmViewer : Class derived from G4Ope 13 // G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide 31 // (Motif) widget OpenGL func 14 // (Motif) widget OpenGL functionality for GEANT4. 32 15 >> 16 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER >> 17 33 #include "globals.hh" 18 #include "globals.hh" 34 19 35 #include "G4OpenGLXmViewer.hh" 20 #include "G4OpenGLXmViewer.hh" 36 #include "G4OpenGLSceneHandler.hh" << 21 >> 22 #include <GL/gl.h> >> 23 #include <GL/glx.h> >> 24 #include <GL/glu.h> >> 25 >> 26 #include "G4ios.hh" >> 27 #include <assert.h> >> 28 #include <unistd.h> >> 29 #include <stdlib.h> 37 30 38 #include "G4VisExtent.hh" 31 #include "G4VisExtent.hh" 39 #include "G4LogicalVolume.hh" 32 #include "G4LogicalVolume.hh" 40 #include "G4VSolid.hh" 33 #include "G4VSolid.hh" 41 #include "G4Point3D.hh" 34 #include "G4Point3D.hh" 42 #include "G4Normal3D.hh" 35 #include "G4Normal3D.hh" 43 36 44 #include "G4Scene.hh" << 37 #include "G4VisManager.hh" 45 << 46 #include "G4OpenGLXmSliderBar.hh" 38 #include "G4OpenGLXmSliderBar.hh" 47 #include "G4OpenGLXmTextField.hh" << 48 39 49 #include "G4Xt.hh" 40 #include "G4Xt.hh" 50 #include <X11/Shell.h> 41 #include <X11/Shell.h> 51 #include <Xm/MainW.h> << 52 #include <Xm/Frame.h> << 53 #include <Xm/DrawingA.h> << 54 42 55 #include <sstream> << 43 static G4ViewParameters viewingParameters; >> 44 void G4OpenGLXmViewerSecondaryLoopPostAction (); 56 45 57 void G4OpenGLXmViewer::ShowView () { 46 void G4OpenGLXmViewer::ShowView () { 58 47 59 // glXWaitGL (); //Wait for effects of all pr << 48 viewingParameters = fVP; 60 //be propagated before progres << 61 // JA: Commented out July 2021 - slows renderi << 62 // don't see any adverse effects. << 63 << 64 glFlush (); << 65 << 66 G4Xt::getInstance () -> SecondaryLoop (); 49 G4Xt::getInstance () -> SecondaryLoop (); 67 50 68 } 51 } 69 52 70 void G4OpenGLXmViewer::ResetView () { << 53 void G4OpenGLXmViewerSecondaryLoopPostAction () 71 // reset global parameters << 54 { 72 G4OpenGLViewer::ResetView(); << 55 if(G4Xt::getInstance () -> GetExitSecondaryLoopCode ()==OGL_EXIT_CODE) 73 << 56 { 74 //reset Xm parameteres << 57 G4VisManager::GetInstance() -> SetCurrentViewParameters() = viewingParameters; 75 zoom_high = fVP.GetZoomFactor() * 10.0; << 58 } 76 zoom_low = fVP.GetZoomFactor() / 10.0; << 77 rot_sens_limit = 90.; << 78 wob_low = 0.; << 79 wob_high = 50.; << 80 wob_sens = 20.; << 81 << 82 bool firstInit = true; << 83 if (GetSceneHandler() != NULL) { << 84 if (GetSceneHandler()->GetScene() != NULL) << 85 firstInit = false; << 86 } << 87 } << 88 if (firstInit) { << 89 pan_sens_limit = 100.; << 90 fPan_sens = pan_sens_limit / 10.0; << 91 dolly_low = fVP.GetDolly() - 1000.0; << 92 dolly_high = fVP.GetDolly() + 1000.0; << 93 } else { << 94 fPan_sens = GetSceneHandler()->GetScene()- << 95 pan_sens_limit = GetSceneHandler()->GetSce << 96 << 97 dolly_high = GetSceneHandler()->GetScene() << 98 dolly_low = -(GetSceneHandler()->GetScene( << 99 } << 100 << 101 UpdateControlPanel (); << 102 << 103 << 104 // FIXME : L.Garnier 12 Oct 2011 << 105 // Has also to change the Camera/Object, but << 106 << 107 } 59 } 108 60 109 61 110 void G4OpenGLXmViewer::GetXmConnection () { 62 void G4OpenGLXmViewer::GetXmConnection () { 111 63 112 G4Xt* interactorManager = G4Xt::getInstance 64 G4Xt* interactorManager = G4Xt::getInstance (); 113 toplevel = (Widget)interactorManager->GetMai 65 toplevel = (Widget)interactorManager->GetMainInteractor(); 114 app = XtWidgetToApplicationContext(topl 66 app = XtWidgetToApplicationContext(toplevel); 115 67 116 if (!toplevel) { 68 if (!toplevel) { 117 fViewId = -1; // This flags an error. 69 fViewId = -1; // This flags an error. 118 G4cerr << "G4OpenGLXmViewer::GetXmConnecti 70 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize" 119 " application context." << G4endl; 71 " application context." << G4endl; 120 return; 72 return; 121 } 73 } 122 74 123 // Better to put this in an X11 resource fil 75 // Better to put this in an X11 resource file !!! 124 std::ostringstream oss; << 76 interactorManager->PutStringInResourceDatabase ("\ 125 oss << << 77 *glxarea*width: 500\n\ 126 "*glxarea*width: " << fVP.GetWindowSizeHin << 78 *glxarea*height: 500\n\ 127 "*glxarea*height: " << fVP.GetWindowSizeHi << 79 *frame*x: 10\n\ 128 /* << 80 *frame*y: 10\n\ 129 // Tried this as a replacement for the abo << 81 *frame*topOffset: 10\n\ 130 // sub-windows (rotation, etc.) came same << 82 *frame*bottomOffset: 10\n\ 131 "*geometry: " << fVP.GetXGeometryString() << 83 *frame*rightOffset: 10\n\ 132 */ << 84 *frame*leftOffset: 10\n\ 133 "*frame*x: 10\n" << 85 *frame*shadowType: SHADOW_IN\n\ 134 "*frame*y: 10\n" << 86 *frame*useColorObj: False\n\ 135 "*frame*topOffset: 10\n" << 87 *frame*primaryColorSetId: 3\n\ 136 "*frame*bottomOffset: 10\n" << 88 *frame*secondaryColorSetId: 3\n\ 137 "*frame*rightOffset: 10\n" << 89 *menubar*useColorObj: False\n\ 138 "*frame*leftOffset: 10\n" << 90 *menubar*primaryColorSetId: 3\n\ 139 "*frame*shadowType: SHADOW_IN\n" << 91 *menubar*secondaryColorSetId: 3\n\ 140 "*frame*useColorObj: False\n" << 92 *toplevel*useColorObj: False\n\ 141 "*frame*primaryColorSetId: 3\n" << 93 *toplevel*primaryColorSetId: 3\n\ 142 "*frame*secondaryColorSetId: 3\n" << 94 *toplevel*secondaryColorSetId: 3\n\ 143 "*menubar*useColorObj: False\n" << 95 "); 144 "*menubar*primaryColorSetId: 3\n" << 96 interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction); 145 "*menubar*secondaryColorSetId: 3\n" << 146 "*toplevel*useColorObj: False\n" << 147 "*toplevel*primaryColorSetId: 3\n" << 148 "*toplevel*secondaryColorSetId: 3\n"; << 149 interactorManager->PutStringInResourceDataba << 150 << 151 // interactorManager->AddSecondaryLoopPostA << 152 97 153 shell = XtAppCreateShell ((String)fName.data 98 shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0); 154 interactorManager->AddShell (shell); 99 interactorManager->AddShell (shell); 155 100 156 dpy = XtDisplay (shell); 101 dpy = XtDisplay (shell); 157 102 158 if (!dpy) { 103 if (!dpy) { 159 fViewId = -1; // This flags an error. 104 fViewId = -1; // This flags an error. 160 G4cerr << "G4OpenGLXmViewer::GetXmConnecti 105 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display." 161 << G4endl; 106 << G4endl; 162 return; 107 return; 163 } 108 } 164 109 165 if (!glXQueryExtension (dpy, &errorBase, &ev 110 if (!glXQueryExtension (dpy, &errorBase, &eventBase)) { 166 fViewId = -1; // This flags an error. 111 fViewId = -1; // This flags an error. 167 G4cerr << "G4OpenGLXmViewer::GetXmConnecti 112 G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension." 168 << G4endl;; 113 << G4endl;; 169 return; 114 return; 170 } 115 } 171 } 116 } 172 117 173 void G4OpenGLXmViewer::CreateMainWindow () { 118 void G4OpenGLXmViewer::CreateMainWindow () { 174 119 175 bgnd = XWhitePixelOfScreen (XtScreen(shell)) 120 bgnd = XWhitePixelOfScreen (XtScreen(shell)); 176 borcol = XBlackPixelOfScreen (XtScreen(shell 121 borcol = XBlackPixelOfScreen (XtScreen(shell)); 177 122 178 ResizeWindow(fVP.GetWindowSizeHintX(),fVP.Ge << 123 XtVaSetValues (shell, 179 << 124 XtNvisual, vi -> visual, 180 G4int x_origin = fVP.GetWindowAbsoluteLocati << 125 XtNdepth, vi -> depth, 181 << 126 XtNcolormap, cmap, 182 // FIXME, screen size != window size on MAC << 127 XtNborderColor, &borcol, 183 // size on MAC. L.Garnier 01/2009 << 128 XtNbackground, &bgnd, 184 G4int y_origin = fVP.GetWindowAbsoluteLocati << 129 XmNtitle, fName.data(), 185 << 130 NULL); 186 if (fVP.IsWindowSizeHintX () && fVP.IsWindow << 187 XtVaSetValues (shell, << 188 XtNvisual, vi -> visual, << 189 XtNdepth, vi -> depth, << 190 XtNcolormap, cmap, << 191 XtNwidth, getWinWidth(), << 192 XtNheight, getWinHeight(), << 193 XtNx, x_origin, << 194 XtNy, y_origin, << 195 XtNborderColor, &borcol, << 196 XtNbackground, &bgnd, << 197 XmNtitle, fName.data(), << 198 NULL); << 199 } else if (fVP.IsWindowSizeHintX () && !(fVP << 200 XtVaSetValues (shell, << 201 XtNvisual, vi -> visual, << 202 XtNdepth, vi -> depth, << 203 XtNcolormap, cmap, << 204 XtNwidth, getWinWidth(), << 205 XtNheight, getWinHeight(), << 206 XtNborderColor, &borcol, << 207 XtNbackground, &bgnd, << 208 XmNtitle, fName.data(), << 209 NULL); << 210 } else if ((!fVP.IsWindowSizeHintX ()) && fV << 211 XtVaSetValues (shell, << 212 XtNvisual, vi -> visual, << 213 XtNdepth, vi -> depth, << 214 XtNcolormap, cmap, << 215 XtNx, x_origin, << 216 XtNy, y_origin, << 217 XtNborderColor, &borcol, << 218 XtNbackground, &bgnd, << 219 XmNtitle, fName.data(), << 220 NULL); << 221 } else { << 222 XtVaSetValues (shell, << 223 XtNvisual, vi -> visual, << 224 XtNdepth, vi -> depth, << 225 XtNcolormap, cmap, << 226 XtNborderColor, &borcol, << 227 XtNbackground, &bgnd, << 228 XmNtitle, fName.data(), << 229 NULL); << 230 } << 231 << 232 131 233 main_win = XtVaCreateManagedWidget ("main_wi 132 main_win = XtVaCreateManagedWidget ("main_win", 234 xmMainWindowWidgetClass, 133 xmMainWindowWidgetClass, 235 shell, 134 shell, 236 XtNvisual, vi -> visual, 135 XtNvisual, vi -> visual, 237 XtNdepth, vi -> depth, 136 XtNdepth, vi -> depth, 238 XtNcolormap, cmap, 137 XtNcolormap, cmap, 239 XtNborderColor, borcol, 138 XtNborderColor, borcol, 240 XtNbackground, bgnd, 139 XtNbackground, bgnd, 241 NULL); 140 NULL); 242 141 243 //*********Create a menu bar for the window* 142 //*********Create a menu bar for the window******** 244 style_str = XmStringCreateLocalized ((char*) << 143 style_str = XmStringCreateLocalized ("Style"); 245 actions_str = XmStringCreateLocalized ((char << 144 actions_str = XmStringCreateLocalized ("Actions"); 246 misc_str = XmStringCreateLocalized ((char*)m << 145 misc_str = XmStringCreateLocalized ("Miscellany"); 247 spec_str = XmStringCreateLocalized ((char*)m << 146 spec_str = XmStringCreateLocalized ("Special"); 248 147 249 menubar = XmVaCreateSimpleMenuBar (main_win, 148 menubar = XmVaCreateSimpleMenuBar (main_win, 250 (char*)menu_str[8].c_str(), << 149 "menubar", 251 XmVaCASCADEBUTTON, style_str, ( << 150 XmVaCASCADEBUTTON, style_str, 'S', 252 XmVaCASCADEBUTTON, actions_str, ( << 151 XmVaCASCADEBUTTON, actions_str, 'A', 253 XmVaCASCADEBUTTON, misc_str, ( << 152 XmVaCASCADEBUTTON, misc_str, 'M', 254 XmVaCASCADEBUTTON, spec_str, ( << 153 XmVaCASCADEBUTTON, spec_str, 'p', 255 XtNvisual, vi -> visual, 154 XtNvisual, vi -> visual, 256 XtNdepth, vi -> depth, 155 XtNdepth, vi -> depth, 257 XtNcolormap, cmap, 156 XtNcolormap, cmap, 258 XtNborderColor, borcol, 157 XtNborderColor, borcol, 259 XtNbackground, bgnd, 158 XtNbackground, bgnd, 260 NULL); 159 NULL); 261 160 262 XmStringFree (style_str); 161 XmStringFree (style_str); 263 XmStringFree (actions_str); 162 XmStringFree (actions_str); 264 XmStringFree (misc_str); 163 XmStringFree (misc_str); 265 XmStringFree (spec_str); 164 XmStringFree (spec_str); 266 165 267 G4cout << "Created menubar" << G4endl; 166 G4cout << "Created menubar" << G4endl; 268 167 269 168 270 //*********Create style pulldown menu on men 169 //*********Create style pulldown menu on menubar********* 271 draw_str = XmStringCreateLocalized ((char*)m << 170 rep_str = XmStringCreateLocalized ("Representation"); 272 bgnd_str = XmStringCreateLocalized ((char*)m << 171 draw_str = XmStringCreateLocalized ("Drawing"); >> 172 bgnd_str = XmStringCreateLocalized ("Background color"); 273 173 274 style_cascade = XmVaCreateSimplePulldownMenu 174 style_cascade = XmVaCreateSimplePulldownMenu 275 (menubar, 175 (menubar, 276 (char*)menu_str[1].c_str(), << 176 "style", 277 0, 177 0, 278 NULL, 178 NULL, 279 XmVaCASCADEBUTTON, draw_str, (KeySym)XK_D << 179 XmVaCASCADEBUTTON, rep_str, 'R', 280 XmVaCASCADEBUTTON, bgnd_str, (KeySym)XK_B << 180 XmVaCASCADEBUTTON, draw_str, 'D', >> 181 XmVaCASCADEBUTTON, bgnd_str, 'B', 281 XtNvisual, vi -> visual, 182 XtNvisual, vi -> visual, 282 XtNdepth, vi -> depth, 183 XtNdepth, vi -> depth, 283 XtNcolormap, cmap, 184 XtNcolormap, cmap, 284 XtNborderColor, borcol, 185 XtNborderColor, borcol, 285 XtNbackground, bgnd, 186 XtNbackground, bgnd, 286 NULL); 187 NULL); 287 188 >> 189 XmStringFree (rep_str); 288 XmStringFree (draw_str); 190 XmStringFree (draw_str); 289 XmStringFree (bgnd_str); 191 XmStringFree (bgnd_str); 290 192 291 // G4cout << "Created Style pulldown menu" 193 // G4cout << "Created Style pulldown menu" << G4endl; 292 194 >> 195 //Add Representation pullright menu to style cascade... >> 196 polyhedron_str = XmStringCreateLocalized ("Polyhedron"); >> 197 nurbs_str = XmStringCreateLocalized ("NURBS"); >> 198 >> 199 rep_style_pullright = XmVaCreateSimplePulldownMenu >> 200 (style_cascade, >> 201 "rep_style", >> 202 0, >> 203 G4OpenGLXmViewer::rep_style_callback, >> 204 XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL, >> 205 XmVaRADIOBUTTON, nurbs_str, 'N', NULL, NULL, >> 206 XmNradioBehavior, True, >> 207 XmNradioAlwaysOne, True, >> 208 XmNuserData, this, >> 209 XtNvisual, vi -> visual, >> 210 XtNdepth, vi -> depth, >> 211 XtNcolormap, cmap, >> 212 XtNborderColor, borcol, >> 213 XtNbackground, bgnd, >> 214 NULL); >> 215 >> 216 Widget special_widget; >> 217 >> 218 G4ViewParameters::RepStyle style; >> 219 style = fVP.GetRepStyle(); >> 220 >> 221 if (style == G4ViewParameters::polyhedron) { >> 222 if(special_widget = XtNameToWidget(rep_style_pullright, "button_0")) { >> 223 XtVaSetValues (special_widget, XmNset, True, NULL); >> 224 } >> 225 } else if (style == G4ViewParameters::nurbs) { >> 226 if(special_widget = XtNameToWidget(rep_style_pullright, "button_1")) { >> 227 XtVaSetValues (special_widget, XmNset, True, NULL); >> 228 } >> 229 } else { >> 230 G4Exception("Invalid Representation style in G4OpenGLXmViewer::CreateContext"); >> 231 } >> 232 XmStringFree (polyhedron_str); >> 233 XmStringFree (nurbs_str); >> 234 >> 235 // G4cout << "Created Representation pulldown menu" << G4endl; >> 236 293 //Add Drawing pullright menu to style cascad 237 //Add Drawing pullright menu to style cascade... 294 wireframe_str = XmStringCreateLocalized ((ch << 238 wireframe_str = XmStringCreateLocalized ("Wireframe"); 295 hlr_str = XmStringCreateLocalized ((char*)me << 239 hlr_str = XmStringCreateLocalized ("Hidden line removal"); 296 hsr_str = XmStringCreateLocalized ((char*)me << 240 hsr_str = XmStringCreateLocalized ("Hidden surface removal"); 297 hlhsr_str = XmStringCreateLocalized ((char*) << 241 hlhsr_str = XmStringCreateLocalized ("Hidden line and surface removal"); 298 242 299 drawing_style_pullright = XmVaCreateSimplePu 243 drawing_style_pullright = XmVaCreateSimplePulldownMenu 300 (style_cascade, 244 (style_cascade, 301 (char*)menu_str[15].c_str(), << 245 "drawing_style", 302 1, 246 1, 303 drawing_style_callback, << 247 G4OpenGLXmViewer::drawing_style_callback, 304 XmVaRADIOBUTTON, wireframe_str, (KeySym)X << 248 XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL, 305 XmVaRADIOBUTTON, hlr_str, (KeySym)X << 249 XmVaRADIOBUTTON, hlr_str, 'L', NULL, NULL, 306 XmVaRADIOBUTTON, hsr_str, (KeySym)X << 250 XmVaRADIOBUTTON, hsr_str, 'S', NULL, NULL, 307 XmVaRADIOBUTTON, hlhsr_str, (KeySym)X << 251 XmVaRADIOBUTTON, hlhsr_str, 'H', NULL, NULL, 308 XmNradioBehavior, True, 252 XmNradioBehavior, True, 309 XmNradioAlwaysOne, True, 253 XmNradioAlwaysOne, True, 310 XmNuserData, this, 254 XmNuserData, this, 311 XtNvisual, vi -> visual, 255 XtNvisual, vi -> visual, 312 XtNdepth, vi -> depth, 256 XtNdepth, vi -> depth, 313 XtNcolormap, cmap, 257 XtNcolormap, cmap, 314 XtNborderColor, borcol, 258 XtNborderColor, borcol, 315 XtNbackground, bgnd, 259 XtNbackground, bgnd, 316 NULL); 260 NULL); 317 261 318 Widget special_widget; << 319 << 320 G4ViewParameters::DrawingStyle d_style; 262 G4ViewParameters::DrawingStyle d_style; 321 d_style = fVP.GetDrawingStyle(); 263 d_style = fVP.GetDrawingStyle(); 322 264 323 if (d_style == G4ViewParameters::wireframe) 265 if (d_style == G4ViewParameters::wireframe) { 324 special_widget = XtNameToWidget(drawing_st << 266 if(special_widget = XtNameToWidget(drawing_style_pullright, "button_0")) { 325 if(special_widget) { << 326 XtVaSetValues (special_widget, XmNset, T 267 XtVaSetValues (special_widget, XmNset, True, NULL); 327 } 268 } 328 } else if (d_style == G4ViewParameters::hlr) 269 } else if (d_style == G4ViewParameters::hlr) { 329 special_widget = XtNameToWidget(drawing_st << 270 if(special_widget = XtNameToWidget(drawing_style_pullright, "button_1")) { 330 if(special_widget) { << 331 XtVaSetValues (special_widget, XmNset, T 271 XtVaSetValues (special_widget, XmNset, True, NULL); 332 } 272 } 333 } else if (d_style == G4ViewParameters::hsr) 273 } else if (d_style == G4ViewParameters::hsr) { 334 special_widget = XtNameToWidget(drawing_st << 274 if(special_widget = XtNameToWidget(drawing_style_pullright, "button_2")) { 335 if(special_widget) { << 336 XtVaSetValues (special_widget, XmNset, T 275 XtVaSetValues (special_widget, XmNset, True, NULL); 337 } 276 } 338 } else if (d_style == G4ViewParameters::hlhs 277 } else if (d_style == G4ViewParameters::hlhsr) { 339 special_widget = XtNameToWidget(drawing_st << 278 if(special_widget = XtNameToWidget(drawing_style_pullright, "button_3")) { 340 if(special_widget) { << 341 XtVaSetValues (special_widget, XmNset, T 279 XtVaSetValues (special_widget, XmNset, True, NULL); 342 } 280 } 343 } else { 281 } else { 344 G4Exception << 282 G4Exception("Invalid Drawing style in G4OpenGLXmViewer::CreateContext"); 345 ("G4OpenGLXmViewer::CreateMainWindow", << 346 "opengl2015", FatalException, << 347 "Invalid Drawing style in G4OpenGLXmVie << 348 } 283 } 349 284 350 XmStringFree (wireframe_str); 285 XmStringFree (wireframe_str); 351 XmStringFree (hlr_str); 286 XmStringFree (hlr_str); 352 XmStringFree (hsr_str); 287 XmStringFree (hsr_str); 353 XmStringFree (hlhsr_str); 288 XmStringFree (hlhsr_str); 354 289 355 // G4cout << "Created Drawing pullright men 290 // G4cout << "Created Drawing pullright menu" << G4endl; 356 291 357 //Add Drawing pullright menu to style cascad 292 //Add Drawing pullright menu to style cascade... 358 white_str = XmStringCreateLocalized ((char*) << 293 white_str = XmStringCreateLocalized ("White"); 359 black_str = XmStringCreateLocalized ((char*) << 294 black_str = XmStringCreateLocalized ("Black"); 360 295 361 background_color_pullright = XmVaCreateSimpl 296 background_color_pullright = XmVaCreateSimplePulldownMenu 362 (style_cascade, 297 (style_cascade, 363 (char*)menu_str[18].c_str(), << 298 "background_color", 364 2, 299 2, 365 background_color_callback, << 300 G4OpenGLXmViewer::background_color_callback, 366 XmVaRADIOBUTTON, white_str, (KeySym)XK_W, << 301 XmVaRADIOBUTTON, white_str, 'W', NULL, NULL, 367 XmVaRADIOBUTTON, black_str, (KeySym)XK_B, << 302 XmVaRADIOBUTTON, black_str, 'B', NULL, NULL, 368 XmNradioBehavior, True, 303 XmNradioBehavior, True, 369 XmNradioAlwaysOne, True, 304 XmNradioAlwaysOne, True, 370 XmNuserData, this, 305 XmNuserData, this, 371 XtNvisual, vi -> visual, 306 XtNvisual, vi -> visual, 372 XtNdepth, vi -> depth, 307 XtNdepth, vi -> depth, 373 XtNcolormap, cmap, 308 XtNcolormap, cmap, 374 XtNborderColor, borcol, 309 XtNborderColor, borcol, 375 XtNbackground, bgnd, 310 XtNbackground, bgnd, 376 NULL); 311 NULL); 377 312 378 if (background.GetRed() == 1. && << 313 if (white_background == true) { 379 background.GetGreen() == 1. && << 314 if(special_widget = XtNameToWidget(background_color_pullright, 380 background.GetBlue() == 1.) { << 315 "button_0")) { 381 special_widget = XtNameToWidget(background << 382 if(special_widget) { << 383 XtVaSetValues (special_widget, XmNset, T 316 XtVaSetValues (special_widget, XmNset, True, NULL); 384 } 317 } 385 } else { << 318 } else if (white_background == false) { 386 special_widget = XtNameToWidget(background << 319 if(special_widget = XtNameToWidget(background_color_pullright, 387 if(special_widget) { << 320 "button_1")) { 388 XtVaSetValues (special_widget, XmNset, T 321 XtVaSetValues (special_widget, XmNset, True, NULL); 389 } 322 } >> 323 } else { >> 324 G4Exception("white_background in G4OpenGLXmViewer is neither true nor false!!"); 390 } 325 } 391 326 392 XmStringFree (white_str); 327 XmStringFree (white_str); 393 XmStringFree (black_str); 328 XmStringFree (black_str); 394 329 395 // G4cout << "Created Background color pull 330 // G4cout << "Created Background color pullright menu" << G4endl; 396 331 397 //*********Create actions pulldown menu on m 332 //*********Create actions pulldown menu on menubar********* 398 rot_str = XmStringCreateLocalized ((char*)me << 333 rot_str = XmStringCreateLocalized ("Rotation control panel"); 399 pan_str = XmStringCreateLocalized ((char*)me << 334 pan_str = XmStringCreateLocalized ("Panning control panel"); 400 set_str = XmStringCreateLocalized ((char*)me << 335 set_str = XmStringCreateLocalized ("Set control panel limits"); 401 336 402 actions_cascade = XmVaCreateSimplePulldownMe 337 actions_cascade = XmVaCreateSimplePulldownMenu 403 (menubar, 338 (menubar, 404 (char*)menu_str[3].c_str(), << 339 "actions", 405 1, 340 1, 406 actions_callback, << 341 G4OpenGLXmViewer::actions_callback, 407 XmVaPUSHBUTTON, rot_str, (KeySym)XK_R, NU << 342 XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL, 408 XmVaPUSHBUTTON, pan_str, (KeySym)XK_P, NU << 343 XmVaPUSHBUTTON, pan_str, 'P', NULL, NULL, 409 XmVaPUSHBUTTON, set_str, (KeySym)XK_S, NU << 344 XmVaPUSHBUTTON, set_str, 'S', NULL, NULL, 410 XmNuserData, this, 345 XmNuserData, this, 411 XtNvisual, vi -> visual, 346 XtNvisual, vi -> visual, 412 XtNdepth, vi -> depth, 347 XtNdepth, vi -> depth, 413 XtNcolormap, cmap, 348 XtNcolormap, cmap, 414 XtNborderColor, borcol, 349 XtNborderColor, borcol, 415 XtNbackground, bgnd, 350 XtNbackground, bgnd, 416 NULL); 351 NULL); 417 352 418 XmStringFree (rot_str); 353 XmStringFree (rot_str); 419 XmStringFree (pan_str); 354 XmStringFree (pan_str); 420 XmStringFree (set_str); 355 XmStringFree (set_str); 421 G4cout << "Created Actions pulldown menu" << 356 G4cout << "Created Actions pulldown menu" << G4endl; 422 357 423 misc_str = XmStringCreateLocalized ((char*)m << 358 misc_str = XmStringCreateLocalized ("Miscellany control panel"); 424 exit_str = XmStringCreateLocalized ((char*)m << 359 exit_str = XmStringCreateLocalized ("Exit to G4Vis>"); 425 print_str = XmStringCreateLocalized ((char*) << 360 print_str = XmStringCreateLocalized ("Create .eps file"); 426 361 427 //*********Create miscellany pulldown menu o 362 //*********Create miscellany pulldown menu on menubar********* 428 misc_cascade = XmVaCreateSimplePulldownMenu 363 misc_cascade = XmVaCreateSimplePulldownMenu 429 (menubar, 364 (menubar, 430 (char*)menu_str[5].c_str(), << 365 "miscellany", 431 2, 366 2, 432 misc_callback, << 367 G4OpenGLXmViewer::misc_callback, 433 XmVaPUSHBUTTON, misc_str, (KeySym)XK_M, << 368 XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL, 434 XmVaPUSHBUTTON, exit_str, (KeySym)XK_E, << 369 XmVaPUSHBUTTON, exit_str, 'E', NULL, NULL, 435 XmVaPUSHBUTTON, print_str, (KeySym)XK_P, << 370 XmVaPUSHBUTTON, print_str, 'P', NULL, NULL, 436 XmNuserData, this, 371 XmNuserData, this, 437 XtNvisual, vi -> visual, 372 XtNvisual, vi -> visual, 438 XtNdepth, vi -> depth, 373 XtNdepth, vi -> depth, 439 XtNcolormap, cmap, 374 XtNcolormap, cmap, 440 XtNborderColor, borcol, 375 XtNborderColor, borcol, 441 XtNbackground, bgnd, 376 XtNbackground, bgnd, 442 NULL); 377 NULL); 443 378 444 XmStringFree (misc_str); 379 XmStringFree (misc_str); 445 XmStringFree (exit_str); 380 XmStringFree (exit_str); 446 XmStringFree (print_str); 381 XmStringFree (print_str); 447 G4cout << "Created Miscellany pulldown menu" 382 G4cout << "Created Miscellany pulldown menu" << G4endl; 448 383 449 trans_str = XmStringCreateLocalized ((char*) << 384 trans_str = XmStringCreateLocalized ("Transparency"); 450 anti_str = XmStringCreateLocalized ((char*)m << 385 anti_str = XmStringCreateLocalized ("Antialiasing"); 451 halo_str = XmStringCreateLocalized ((char*)m << 386 halo_str = XmStringCreateLocalized ("Haloing"); 452 aux_edge_str = XmStringCreateLocalized ((cha << 453 387 454 //*********Create special pulldown menu on m 388 //*********Create special pulldown menu on menubar********* 455 spec_cascade = XmVaCreateSimplePulldownMenu 389 spec_cascade = XmVaCreateSimplePulldownMenu 456 (menubar, 390 (menubar, 457 (char*)menu_str[7].c_str(), << 391 "special", 458 3, 392 3, 459 NULL, 393 NULL, 460 XmVaCASCADEBUTTON, trans_str, (KeySym) << 394 XmVaCASCADEBUTTON, trans_str, 'T', 461 XmVaCASCADEBUTTON, anti_str, (KeySym) << 395 XmVaCASCADEBUTTON, anti_str, 'A', 462 XmVaCASCADEBUTTON, halo_str, (KeySym) << 396 XmVaCASCADEBUTTON, halo_str, 'H', 463 XmVaCASCADEBUTTON, aux_edge_str, (KeySym) << 464 XtNvisual, vi -> visual, 397 XtNvisual, vi -> visual, 465 XtNdepth, vi -> depth, 398 XtNdepth, vi -> depth, 466 XtNcolormap, cmap, 399 XtNcolormap, cmap, 467 XtNborderColor, borcol, 400 XtNborderColor, borcol, 468 XtNbackground, bgnd, 401 XtNbackground, bgnd, 469 NULL); 402 NULL); 470 403 471 XmStringFree (trans_str); 404 XmStringFree (trans_str); 472 XmStringFree (anti_str); 405 XmStringFree (anti_str); 473 XmStringFree (halo_str); 406 XmStringFree (halo_str); 474 XmStringFree (aux_edge_str); << 475 407 476 // G4cout << "Created Special pulldown menu 408 // G4cout << "Created Special pulldown menu" << G4endl; 477 409 478 //Add Transparency pullright menu to special 410 //Add Transparency pullright menu to special cascade... 479 off_str = XmStringCreateLocalized ((char*)me << 411 off_str = XmStringCreateLocalized ("Off"); 480 on_str = XmStringCreateLocalized ((char*)men << 412 on_str = XmStringCreateLocalized ("On"); 481 413 482 transparency_pullright = XmVaCreateSimplePul 414 transparency_pullright = XmVaCreateSimplePulldownMenu 483 (spec_cascade, 415 (spec_cascade, 484 (char*)menu_str[26].c_str(), << 416 "transparency", 485 0, 417 0, 486 transparency_callback, << 418 G4OpenGLXmViewer::transparency_callback, 487 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 419 XmVaRADIOBUTTON, off_str, 'f', NULL, NULL, 488 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, N << 420 XmVaRADIOBUTTON, on_str, 'n', NULL, NULL, 489 XmNradioBehavior, True, 421 XmNradioBehavior, True, 490 XmNradioAlwaysOne, True, 422 XmNradioAlwaysOne, True, 491 XmNuserData, this, 423 XmNuserData, this, 492 XtNvisual, vi -> visual, 424 XtNvisual, vi -> visual, 493 XtNdepth, vi -> depth, 425 XtNdepth, vi -> depth, 494 XtNcolormap, cmap, 426 XtNcolormap, cmap, 495 XtNborderColor, borcol, 427 XtNborderColor, borcol, 496 XtNbackground, bgnd, 428 XtNbackground, bgnd, 497 NULL); 429 NULL); 498 430 499 if (transparency_enabled == false) { 431 if (transparency_enabled == false) { 500 special_widget = XtNameToWidget(transparen << 432 if(special_widget = XtNameToWidget(transparency_pullright, 501 if(special_widget) { << 433 "button_0")) { 502 XtVaSetValues (special_widget, XmNset, T 434 XtVaSetValues (special_widget, XmNset, True, NULL); 503 } 435 } 504 } else if (transparency_enabled == true) { 436 } else if (transparency_enabled == true) { 505 special_widget = XtNameToWidget(transparen << 437 if(special_widget = XtNameToWidget(transparency_pullright, 506 if(special_widget) { << 438 "button_1")) { 507 XtVaSetValues (special_widget, XmNset, T 439 XtVaSetValues (special_widget, XmNset, True, NULL); 508 } 440 } 509 } else { 441 } else { 510 G4Exception << 442 G4Exception("transparency_enabled in G4OpenGLXmViewer is neither true nor false!!"); 511 ("G4OpenGLXmViewer::CreateMainWindow", << 512 "opengl2016", FatalException, << 513 "transparency_enabled in G4OpenGLXmView << 514 } 443 } 515 444 516 //Add antialias pullright menu to special ca 445 //Add antialias pullright menu to special cascade... 517 antialias_pullright = XmVaCreateSimplePulldo 446 antialias_pullright = XmVaCreateSimplePulldownMenu 518 (spec_cascade, 447 (spec_cascade, 519 (char*)menu_str[28].c_str(), << 448 "antialias", 520 1, 449 1, 521 antialias_callback, << 450 G4OpenGLXmViewer::antialias_callback, 522 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 451 XmVaRADIOBUTTON, off_str, 'f', NULL, NULL, 523 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, N << 452 XmVaRADIOBUTTON, on_str, 'n', NULL, NULL, 524 XmNradioBehavior, True, 453 XmNradioBehavior, True, 525 XmNradioAlwaysOne, True, 454 XmNradioAlwaysOne, True, 526 XmNuserData, this, 455 XmNuserData, this, 527 XtNvisual, vi -> visual, 456 XtNvisual, vi -> visual, 528 XtNdepth, vi -> depth, 457 XtNdepth, vi -> depth, 529 XtNcolormap, cmap, 458 XtNcolormap, cmap, 530 XtNborderColor, borcol, 459 XtNborderColor, borcol, 531 XtNbackground, bgnd, 460 XtNbackground, bgnd, 532 NULL); 461 NULL); 533 462 534 if (antialiasing_enabled == false) { 463 if (antialiasing_enabled == false) { 535 special_widget = XtNameToWidget(antialias_ << 464 if(special_widget = XtNameToWidget(antialias_pullright, 536 if(special_widget) { << 465 "button_0")) { 537 XtVaSetValues (special_widget, XmNset, T 466 XtVaSetValues (special_widget, XmNset, True, NULL); 538 } 467 } 539 } else if (antialiasing_enabled == true) { 468 } else if (antialiasing_enabled == true) { 540 special_widget = XtNameToWidget(antialias_ << 469 if(special_widget = XtNameToWidget(antialias_pullright, 541 if(special_widget) { << 470 "button_1")) { 542 XtVaSetValues (special_widget, XmNset, T 471 XtVaSetValues (special_widget, XmNset, True, NULL); 543 } 472 } 544 } else { 473 } else { 545 G4Exception << 474 G4Exception("antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!"); 546 ("G4OpenGLXmViewer::CreateMainWindow", << 547 "opengl2017", FatalException, << 548 "antialiasing_enabled in G4OpenGLXmView << 549 } 475 } 550 476 551 //Add Haloing pullright menu to special casc 477 //Add Haloing pullright menu to special cascade... 552 haloing_pullright = XmVaCreateSimplePulldown 478 haloing_pullright = XmVaCreateSimplePulldownMenu 553 (spec_cascade, 479 (spec_cascade, 554 (char*)menu_str[30].c_str(), << 480 "haloing", 555 2, 481 2, 556 haloing_callback, << 482 G4OpenGLXmViewer::haloing_callback, 557 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 483 XmVaRADIOBUTTON, off_str, 'f', NULL, NULL, 558 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, N << 484 XmVaRADIOBUTTON, on_str, 'n', NULL, NULL, 559 XmNradioBehavior, True, 485 XmNradioBehavior, True, 560 XmNradioAlwaysOne, True, 486 XmNradioAlwaysOne, True, 561 XmNuserData, this, 487 XmNuserData, this, 562 XtNvisual, vi -> visual, 488 XtNvisual, vi -> visual, 563 XtNdepth, vi -> depth, 489 XtNdepth, vi -> depth, 564 XtNcolormap, cmap, 490 XtNcolormap, cmap, 565 XtNborderColor, borcol, 491 XtNborderColor, borcol, 566 XtNbackground, bgnd, 492 XtNbackground, bgnd, 567 NULL); 493 NULL); 568 494 569 if (haloing_enabled == false) { 495 if (haloing_enabled == false) { 570 special_widget = XtNameToWidget(haloing_pu << 496 if(special_widget = XtNameToWidget(haloing_pullright, 571 if(special_widget) { << 497 "button_0")) { 572 XtVaSetValues (special_widget, XmNset, T 498 XtVaSetValues (special_widget, XmNset, True, NULL); 573 } 499 } 574 } else if (haloing_enabled == true) { 500 } else if (haloing_enabled == true) { 575 special_widget = XtNameToWidget(haloing_pu << 501 if(special_widget = XtNameToWidget(haloing_pullright, 576 if(special_widget) { << 502 "button_1")) { 577 XtVaSetValues (special_widget, XmNset, T << 578 } << 579 } else { << 580 G4Exception << 581 ("G4OpenGLXmViewer::CreateMainWindow", << 582 "opengl2018", FatalException, << 583 "haloing_enabled in G4OpenGLXmViewer is << 584 } << 585 << 586 //Add Aux_Edge pullright menu to special cas << 587 aux_edge_pullright = XmVaCreateSimplePulldow << 588 (spec_cascade, << 589 (char*)menu_str[32].c_str(), << 590 3, << 591 aux_edge_callback, << 592 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 593 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, N << 594 XmNradioBehavior, True, << 595 XmNradioAlwaysOne, True, << 596 XmNuserData, this, << 597 XtNvisual, vi -> visual, << 598 XtNdepth, vi -> depth, << 599 XtNcolormap, cmap, << 600 XtNborderColor, borcol, << 601 XtNbackground, bgnd, << 602 NULL); << 603 << 604 if (!fVP.IsAuxEdgeVisible()) { << 605 special_widget = XtNameToWidget(aux_edge_p << 606 if(special_widget) { << 607 XtVaSetValues (special_widget, XmNset, T 503 XtVaSetValues (special_widget, XmNset, True, NULL); 608 } 504 } 609 } else { 505 } else { 610 special_widget = XtNameToWidget(aux_edge_p << 506 G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!"); 611 if(special_widget) { << 612 XtVaSetValues (special_widget, XmNset, T << 613 } << 614 } 507 } 615 508 616 XtManageChild (menubar); 509 XtManageChild (menubar); 617 frame = XtVaCreateManagedWidget ((char*)menu << 510 frame = XtVaCreateManagedWidget ("frame", xmFrameWidgetClass, main_win, 618 xmFrameWidgetClass, main_win, << 619 XtNvisual, vi -> visual, 511 XtNvisual, vi -> visual, 620 XtNdepth, vi -> depth, 512 XtNdepth, vi -> depth, 621 XtNcolormap, cmap, 513 XtNcolormap, cmap, 622 XtNborderColor, borcol, 514 XtNborderColor, borcol, 623 XtNbackground, bgnd, 515 XtNbackground, bgnd, 624 NULL); 516 NULL); 625 517 626 glxarea = XtVaCreateManagedWidget ((char*)me << 518 glxarea = XtVaCreateManagedWidget ("glxarea", 627 xmDrawingAreaWidgetClass, 519 xmDrawingAreaWidgetClass, 628 frame, 520 frame, 629 XtNvisual, vi -> visual, 521 XtNvisual, vi -> visual, 630 XtNdepth, vi -> depth, 522 XtNdepth, vi -> depth, 631 XtNcolormap, cmap, 523 XtNcolormap, cmap, 632 XtNborderColor, borcol, 524 XtNborderColor, borcol, 633 XtNbackground, bgnd, 525 XtNbackground, bgnd, 634 NULL); 526 NULL); 635 527 >> 528 XtAddCallback (glxarea, >> 529 XmNexposeCallback, >> 530 G4OpenGLXmViewer::expose_callback, >> 531 this); >> 532 >> 533 XtAddCallback (glxarea, >> 534 XmNresizeCallback, >> 535 G4OpenGLXmViewer::resize_callback, >> 536 this); 636 537 637 XmMainWindowSetAreas (main_win, // main wid 538 XmMainWindowSetAreas (main_win, // main widget, children are specified 638 menubar, // widget to use as menu bar 539 menubar, // widget to use as menu bar 639 NULL, // widget to use as command w 540 NULL, // widget to use as command window 640 NULL, // widget for horizontal scro 541 NULL, // widget for horizontal scroll bar 641 NULL, // widget for vertical scroll 542 NULL, // widget for vertical scroll bar 642 frame // widget to be used for work 543 frame // widget to be used for work window 643 ); 544 ); 644 545 645 XtRealizeWidget(shell); 546 XtRealizeWidget(shell); 646 547 647 // Once widget is realized (ie, associated w 548 // Once widget is realized (ie, associated with a created X window), we 648 // can bind the OpenGL rendering context to 549 // can bind the OpenGL rendering context to the window. 649 550 650 win = XtWindow (glxarea); << 551 Dimension width, height; 651 << 552 XtVaGetValues (glxarea,XmNwidth,&width,XmNheight,&height,NULL); 652 glXMakeCurrent (dpy, win, cxMaster); << 553 WinSize_x = (G4int) width; >> 554 WinSize_y = (G4int) height; 653 555 654 // This should be add AFTER glXMakeCurrent d << 556 win = XtWindow (glxarea); 655 XtAddCallback (glxarea, << 656 XmNresizeCallback, << 657 resize_callback, << 658 this); << 659 557 660 XtAddCallback (glxarea, << 558 glXMakeCurrent (dpy, win, cx); 661 XmNexposeCallback, << 662 expose_callback, << 663 this); << 664 559 665 } 560 } 666 561 667 G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSc 562 G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSceneHandler& scene): 668 G4VViewer (scene, -1), 563 G4VViewer (scene, -1), 669 G4OpenGLViewer (scene), 564 G4OpenGLViewer (scene), 670 G4OpenGLXViewer (scene), 565 G4OpenGLXViewer (scene), 671 toplevel (0), << 566 zoom_low (fVP.GetZoomFactor() / 10.0), 672 shell (0), << 567 zoom_high (fVP.GetZoomFactor() * 10.0), 673 main_win (0), << 568 dolly_low (fVP.GetDolly() - 1000.0), 674 menubar (0), << 569 dolly_high (fVP.GetDolly() + 1000.0), 675 style_cascade (0), << 570 rot_sens (4.), 676 actions_cascade (0), << 571 frameNo (0), 677 misc_cascade (0), << 572 wob_sens (20.), 678 spec_cascade (0), << 573 rot_sens_limit (90.), 679 drawing_style_pullright (0), << 574 pan_sens_limit (100.), 680 background_color_pullright (0), << 681 transparency_pullright (0), << 682 antialias_pullright (0), << 683 haloing_pullright (0), << 684 aux_edge_pullright (0), << 685 frame (0), << 686 glxarea (0), << 687 style_str (0), << 688 actions_str (0), << 689 misc_str (0), << 690 spec_str (0), << 691 draw_str (0), << 692 polyhedron_str (0), << 693 wireframe_str (0), << 694 hlr_str (0), << 695 hsr_str (0), << 696 hlhsr_str (0), << 697 set_str (0), << 698 rot_str (0), << 699 pan_str (0), << 700 exit_str (0), << 701 quit_str (0), << 702 print_str (0), << 703 white_str (0), << 704 black_str (0), << 705 anti_str (0), << 706 trans_str (0), << 707 halo_str (0), << 708 aux_edge_str (0), << 709 bgnd_str (0), << 710 off_str (0), << 711 on_str (0), << 712 zoom_high (0.0), << 713 zoom_low (0.0), << 714 pan_low (0.0), << 715 pan_high (0.0), << 716 dolly_low (0.0), << 717 dolly_high (0.0), << 718 fov (0.0), 575 fov (0.0), 719 rot_sens_limit (0.0), << 720 pan_sens_limit (0.0), << 721 wob_high (0.0), << 722 wob_low (0.0), << 723 wob_sens (0.0), << 724 pan_right (false), << 725 rotate_right (false), << 726 pan_up (false), << 727 rotate_up (false), << 728 original_vp(fVP.GetViewpointDirection()), 576 original_vp(fVP.GetViewpointDirection()), 729 frameNo (0), << 577 fppanning_top (NULL), 730 fprotation_top (0), << 578 fprotation_top (NULL), 731 fprotation_button_box (0), << 579 fpmiscellany_top (NULL), 732 fprotation_button1 (0), << 580 fpsetting_top (NULL), 733 fprotation_button2 (0), << 581 fpprint_top (NULL), 734 fprotation_slider_box (0), << 582 fppanning_slider (NULL), 735 fprotation_slider (0), << 583 fprotation_slider (NULL), 736 fprotation_arrow_box (0), << 584 fpzoom_slider (NULL), 737 fprotation_arrow (0), << 585 fpdolly_slider (NULL) 738 fppanning_top (0), << 739 fppanning_box (0), << 740 fppanning_arrows (0), << 741 fppanning_slider (0), << 742 fpzoom_box (0), << 743 fpzoom_slider (0), << 744 fpdolly_box (0), << 745 fpdolly_slider (0), << 746 fpsetting_top (0), << 747 fpsetting_box (0), << 748 fppan_set (0), << 749 fprot_set (0), << 750 fpzoom_upper (0), << 751 fpzoom_lower (0), << 752 fpdolly_upper (0), << 753 fpdolly_lower (0), << 754 fpok_button (0), << 755 fpmiscellany_top (0), << 756 fpwobble_box (0), << 757 fpwobble_button (0), << 758 fpwobble_slider (0), << 759 fpreset_box (0), << 760 fpreset_button (0), << 761 fpproj_style_box (0), << 762 fporthogonal_button (0), << 763 fpperspective_button (0), << 764 fpfov_text (0), << 765 fpprint_top (0), << 766 fpprint_box (0), << 767 fpprint_col_box (0), << 768 fpprint_style_box (0), << 769 fpprint_text (0), << 770 fpprint_button (0), << 771 fpprint_line (0), << 772 fpprint_col_radio1 (0), << 773 fpprint_col_radio2 (0), << 774 fpprint_style_radio1 (0), << 775 fpprint_style_radio2 (0) << 776 { 586 { >> 587 >> 588 WinSize_x = 100; >> 589 WinSize_y = 100; >> 590 vi_immediate = 0; >> 591 vi_stored = 0; >> 592 777 GetXmConnection (); 593 GetXmConnection (); 778 ResetView(); << 779 if (fViewId < 0) return; 594 if (fViewId < 0) return; 780 } << 781 << 782 << 783 void G4OpenGLXmViewer::UpdateControlPanel () { << 784 << 785 // set new values << 786 << 787 if (fprotation_slider) { << 788 fprotation_slider->SetInitialValue(fRot_se << 789 fprotation_slider->SetMaxValue(rot_sens_li << 790 fprotation_slider->SetMinValue(0); << 791 } << 792 if (fppanning_slider) { << 793 fppanning_slider->SetInitialValue(fPan_sen << 794 fppanning_slider->SetMaxValue(pan_sens_lim << 795 fppanning_slider->SetMinValue(0); << 796 } << 797 if (fpzoom_slider) { << 798 fpzoom_slider->SetInitialValue(fVP.GetZoom << 799 fpzoom_slider->SetMinValue(zoom_low); << 800 fpzoom_slider->SetMaxValue(zoom_high); << 801 } << 802 if (fpdolly_slider) { << 803 fpdolly_slider->SetInitialValue(fVP.GetDol << 804 fpdolly_slider->SetMinValue(dolly_low); << 805 fpdolly_slider->SetMaxValue(dolly_high); << 806 } << 807 << 808 if (fpwobble_slider) { << 809 fpwobble_slider->SetInitialValue(fVP.GetDo << 810 } << 811 595 812 if (fppan_set) { << 596 // Try for a visual suitable for OpenGLImmediate.. 813 fppan_set->SetValue(pan_sens_limit); << 597 // first try for a single buffered RGB window 814 } << 598 if (vi_immediate = 815 << 599 glXChooseVisual (dpy, XDefaultScreen (dpy), snglBuf_RGBA)) { 816 if (fprot_set) { << 600 attributeList = snglBuf_RGBA; 817 fprot_set->SetValue(rot_sens_limit); << 601 doublebuffer = false; 818 } << 602 } 819 << 603 820 if (fpzoom_upper) { << 604 if (!vi_immediate){ 821 fpzoom_upper->SetValue(zoom_high); << 605 // next try for a double buffered RGB, but Draw to top buffer 822 } << 606 if (vi_immediate = 823 << 607 glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA)) { 824 if (fpzoom_lower) { << 608 attributeList = dblBuf_RGBA; 825 fpzoom_lower->SetValue(zoom_low); << 609 doublebuffer = true; 826 } << 610 } 827 if (fpdolly_upper) { << 828 fpdolly_upper->SetValue(dolly_high); << 829 } 611 } 830 612 831 if (fpdolly_lower) { << 613 // Now try for a visual suitable for OpenGLStored... 832 fpdolly_lower->SetValue(dolly_low); << 614 // Try for a double buffered RGB window >> 615 if (vi_stored = glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA)) { >> 616 attributeList = dblBuf_RGBA; >> 617 doublebuffer = true; 833 } 618 } 834 619 835 << 836 } 620 } 837 << 838 << 839 G4OpenGLXmViewer::~G4OpenGLXmViewer () 621 G4OpenGLXmViewer::~G4OpenGLXmViewer () 840 { 622 { 841 XtDestroyWidget (shell); 623 XtDestroyWidget (shell); 842 win = 0; // ...to avoid XDestroyWindow in G4 << 843 // because XtDestroyWidget has already destr << 844 G4Xt::getInstance () ->RemoveShell (shell); 624 G4Xt::getInstance () ->RemoveShell (shell); 845 625 846 /****************************** 626 /****************************** 847 if (fprotation_top) { 627 if (fprotation_top) { 848 delete fprotation_top; 628 delete fprotation_top; 849 } 629 } 850 630 851 if (fppanning_top) { 631 if (fppanning_top) { 852 delete fppanning_top; 632 delete fppanning_top; 853 } 633 } 854 634 855 if (fpsetting_top) { 635 if (fpsetting_top) { 856 delete fpsetting_top; 636 delete fpsetting_top; 857 } 637 } 858 638 859 if (fpmiscellany_top) { 639 if (fpmiscellany_top) { 860 delete fpmiscellany_top; 640 delete fpmiscellany_top; 861 } 641 } 862 ******************************/ 642 ******************************/ 863 << 864 } 643 } >> 644 >> 645 #endif 865 646