Geant4-11
G4OpenGLXmViewer.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//
29// Andrew Walkden 10th February 1997
30// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
31// (Motif) widget OpenGL functionality for GEANT4.
32
33#include "globals.hh"
34
35#include "G4OpenGLXmViewer.hh"
37
38#include "G4VisExtent.hh"
39#include "G4LogicalVolume.hh"
40#include "G4VSolid.hh"
41#include "G4Point3D.hh"
42#include "G4Normal3D.hh"
43
44#include "G4Scene.hh"
45
48
49#include "G4Xt.hh"
50#include <X11/Shell.h>
51#include <Xm/MainW.h>
52#include <Xm/Frame.h>
53#include <Xm/DrawingA.h>
54
55#include <sstream>
56
58
59// glXWaitGL (); //Wait for effects of all previous OpenGL commands to
60 //be propagated before progressing.
61// JA: Commented out July 2021 - slows rendering down in some cases and I
62// don't see any adverse effects.
63
64 glFlush ();
65
66 G4Xt::getInstance () -> SecondaryLoop ();
67
68}
69
71 // reset global parameters
73
74 //reset Xm parameteres
75 zoom_high = fVP.GetZoomFactor() * 10.0;
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.;
91 dolly_low = fVP.GetDolly() - 1000.0;
92 dolly_high = fVP.GetDolly() + 1000.0;
93 } else {
96
99 }
100
102
103
104 // FIXME : L.Garnier 12 Oct 2011
105 // Has also to change the Camera/Object, but tricky to do...
106
107}
108
109
111
112 G4Xt* interactorManager = G4Xt::getInstance ();
113 toplevel = (Widget)interactorManager->GetMainInteractor();
114 app = XtWidgetToApplicationContext(toplevel);
115
116 if (!toplevel) {
117 fViewId = -1; // This flags an error.
118 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
119 " application context." << G4endl;
120 return;
121 }
122
123 // Better to put this in an X11 resource file !!!
124 std::ostringstream oss;
125 oss <<
126 "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
127 "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
128 /*
129 // Tried this as a replacement for the above two lines, but
130 // sub-windows (rotation, etc.) came same size!!
131 "*geometry: " << fVP.GetXGeometryString() << "\n"
132 */
133 "*frame*x: 10\n"
134 "*frame*y: 10\n"
135 "*frame*topOffset: 10\n"
136 "*frame*bottomOffset: 10\n"
137 "*frame*rightOffset: 10\n"
138 "*frame*leftOffset: 10\n"
139 "*frame*shadowType: SHADOW_IN\n"
140 "*frame*useColorObj: False\n"
141 "*frame*primaryColorSetId: 3\n"
142 "*frame*secondaryColorSetId: 3\n"
143 "*menubar*useColorObj: False\n"
144 "*menubar*primaryColorSetId: 3\n"
145 "*menubar*secondaryColorSetId: 3\n"
146 "*toplevel*useColorObj: False\n"
147 "*toplevel*primaryColorSetId: 3\n"
148 "*toplevel*secondaryColorSetId: 3\n";
149 interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
150
151 // interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
152
153 shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0);
154 interactorManager->AddShell (shell);
155
156 dpy = XtDisplay (shell);
157
158 if (!dpy) {
159 fViewId = -1; // This flags an error.
160 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
161 << G4endl;
162 return;
163 }
164
165 if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
166 fViewId = -1; // This flags an error.
167 G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
168 << G4endl;;
169 return;
170 }
171}
172
174
175 bgnd = XWhitePixelOfScreen (XtScreen(shell));
176 borcol = XBlackPixelOfScreen (XtScreen(shell));
177
179
180 G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
181
182 // FIXME, screen size != window size on MAC, but I don't know have to get the menuBar
183 // size on MAC. L.Garnier 01/2009
184 G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
185
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);
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);
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
233 main_win = XtVaCreateManagedWidget ("main_win",
234 xmMainWindowWidgetClass,
235 shell,
236 XtNvisual, vi -> visual,
237 XtNdepth, vi -> depth,
238 XtNcolormap, cmap,
239 XtNborderColor, borcol,
240 XtNbackground, bgnd,
241 NULL);
242
243 //*********Create a menu bar for the window********
244 style_str = XmStringCreateLocalized ((char*)"Style");
245 actions_str = XmStringCreateLocalized ((char*)"Actions");
246 misc_str = XmStringCreateLocalized ((char*)"Miscellany");
247 spec_str = XmStringCreateLocalized ((char*)"Special");
248
249 menubar = XmVaCreateSimpleMenuBar (main_win,
250 (char*)"menubar",
251 XmVaCASCADEBUTTON, style_str, (KeySym)XK_S, /*G.Barrand : cast to KeySym and use XK_*/
252 XmVaCASCADEBUTTON, actions_str, (KeySym)XK_A,
253 XmVaCASCADEBUTTON, misc_str, (KeySym)XK_M,
254 XmVaCASCADEBUTTON, spec_str, (KeySym)XK_p,
255 XtNvisual, vi -> visual,
256 XtNdepth, vi -> depth,
257 XtNcolormap, cmap,
258 XtNborderColor, borcol,
259 XtNbackground, bgnd,
260 NULL);
261
262 XmStringFree (style_str);
263 XmStringFree (actions_str);
264 XmStringFree (misc_str);
265 XmStringFree (spec_str);
266
267 G4cout << "Created menubar" << G4endl;
268
269
270 //*********Create style pulldown menu on menubar*********
271 draw_str = XmStringCreateLocalized ((char*)"Drawing");
272 bgnd_str = XmStringCreateLocalized ((char*)"Background color");
273
274 style_cascade = XmVaCreateSimplePulldownMenu
275 (menubar,
276 (char*)"style",
277 0,
278 NULL,
279 XmVaCASCADEBUTTON, draw_str, (KeySym)XK_D,
280 XmVaCASCADEBUTTON, bgnd_str, (KeySym)XK_B,
281 XtNvisual, vi -> visual,
282 XtNdepth, vi -> depth,
283 XtNcolormap, cmap,
284 XtNborderColor, borcol,
285 XtNbackground, bgnd,
286 NULL);
287
288 XmStringFree (draw_str);
289 XmStringFree (bgnd_str);
290
291 // G4cout << "Created Style pulldown menu" << G4endl;
292
293 //Add Drawing pullright menu to style cascade...
294 wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
295 hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
296 hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
297 hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
298
299 drawing_style_pullright = XmVaCreateSimplePulldownMenu
301 (char*)"drawing_style",
302 1,
304 XmVaRADIOBUTTON, wireframe_str, (KeySym)XK_W, NULL, NULL,
305 XmVaRADIOBUTTON, hlr_str, (KeySym)XK_L, NULL, NULL,
306 XmVaRADIOBUTTON, hsr_str, (KeySym)XK_S, NULL, NULL,
307 XmVaRADIOBUTTON, hlhsr_str, (KeySym)XK_H, NULL, NULL,
308 XmNradioBehavior, True,
309 XmNradioAlwaysOne, True,
310 XmNuserData, this,
311 XtNvisual, vi -> visual,
312 XtNdepth, vi -> depth,
313 XtNcolormap, cmap,
314 XtNborderColor, borcol,
315 XtNbackground, bgnd,
316 NULL);
317
318 Widget special_widget;
319
321 d_style = fVP.GetDrawingStyle();
322
323 if (d_style == G4ViewParameters::wireframe) {
324 special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
325 if(special_widget) {
326 XtVaSetValues (special_widget, XmNset, True, NULL);
327 }
328 } else if (d_style == G4ViewParameters::hlr) {
329 special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
330 if(special_widget) {
331 XtVaSetValues (special_widget, XmNset, True, NULL);
332 }
333 } else if (d_style == G4ViewParameters::hsr) {
334 special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
335 if(special_widget) {
336 XtVaSetValues (special_widget, XmNset, True, NULL);
337 }
338 } else if (d_style == G4ViewParameters::hlhsr) {
339 special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
340 if(special_widget) {
341 XtVaSetValues (special_widget, XmNset, True, NULL);
342 }
343 } else {
345 ("G4OpenGLXmViewer::CreateMainWindow",
346 "opengl2015", FatalException,
347 "Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
348 }
349
350 XmStringFree (wireframe_str);
351 XmStringFree (hlr_str);
352 XmStringFree (hsr_str);
353 XmStringFree (hlhsr_str);
354
355 // G4cout << "Created Drawing pullright menu" << G4endl;
356
357 //Add Drawing pullright menu to style cascade...
358 white_str = XmStringCreateLocalized ((char*)"White");
359 black_str = XmStringCreateLocalized ((char*)"Black");
360
361 background_color_pullright = XmVaCreateSimplePulldownMenu
363 (char*)"background_color",
364 2,
366 XmVaRADIOBUTTON, white_str, (KeySym)XK_W, NULL, NULL,
367 XmVaRADIOBUTTON, black_str, (KeySym)XK_B, NULL, NULL,
368 XmNradioBehavior, True,
369 XmNradioAlwaysOne, True,
370 XmNuserData, this,
371 XtNvisual, vi -> visual,
372 XtNdepth, vi -> depth,
373 XtNcolormap, cmap,
374 XtNborderColor, borcol,
375 XtNbackground, bgnd,
376 NULL);
377
378 if (background.GetRed() == 1. &&
379 background.GetGreen() == 1. &&
380 background.GetBlue() == 1.) {
381 special_widget = XtNameToWidget(background_color_pullright, "button_0");
382 if(special_widget) {
383 XtVaSetValues (special_widget, XmNset, True, NULL);
384 }
385 } else {
386 special_widget = XtNameToWidget(background_color_pullright, "button_1");
387 if(special_widget) {
388 XtVaSetValues (special_widget, XmNset, True, NULL);
389 }
390 }
391
392 XmStringFree (white_str);
393 XmStringFree (black_str);
394
395 // G4cout << "Created Background color pullright menu" << G4endl;
396
397 //*********Create actions pulldown menu on menubar*********
398 rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
399 pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
400 set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
401
402 actions_cascade = XmVaCreateSimplePulldownMenu
403 (menubar,
404 (char*)"actions",
405 1,
407 XmVaPUSHBUTTON, rot_str, (KeySym)XK_R, NULL, NULL,
408 XmVaPUSHBUTTON, pan_str, (KeySym)XK_P, NULL, NULL,
409 XmVaPUSHBUTTON, set_str, (KeySym)XK_S, NULL, NULL,
410 XmNuserData, this,
411 XtNvisual, vi -> visual,
412 XtNdepth, vi -> depth,
413 XtNcolormap, cmap,
414 XtNborderColor, borcol,
415 XtNbackground, bgnd,
416 NULL);
417
418 XmStringFree (rot_str);
419 XmStringFree (pan_str);
420 XmStringFree (set_str);
421 G4cout << "Created Actions pulldown menu" << G4endl;
422
423 misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
424 exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
425 print_str = XmStringCreateLocalized ((char*)"Create .eps file");
426
427 //*********Create miscellany pulldown menu on menubar*********
428 misc_cascade = XmVaCreateSimplePulldownMenu
429 (menubar,
430 (char*)"miscellany",
431 2,
433 XmVaPUSHBUTTON, misc_str, (KeySym)XK_M, NULL, NULL,
434 XmVaPUSHBUTTON, exit_str, (KeySym)XK_E, NULL, NULL,
435 XmVaPUSHBUTTON, print_str, (KeySym)XK_P, NULL, NULL,
436 XmNuserData, this,
437 XtNvisual, vi -> visual,
438 XtNdepth, vi -> depth,
439 XtNcolormap, cmap,
440 XtNborderColor, borcol,
441 XtNbackground, bgnd,
442 NULL);
443
444 XmStringFree (misc_str);
445 XmStringFree (exit_str);
446 XmStringFree (print_str);
447 G4cout << "Created Miscellany pulldown menu" << G4endl;
448
449 trans_str = XmStringCreateLocalized ((char*)"Transparency");
450 anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
451 halo_str = XmStringCreateLocalized ((char*)"Haloing");
452 aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
453
454 //*********Create special pulldown menu on menubar*********
455 spec_cascade = XmVaCreateSimplePulldownMenu
456 (menubar,
457 (char*)"special",
458 3,
459 NULL,
460 XmVaCASCADEBUTTON, trans_str, (KeySym)XK_T,
461 XmVaCASCADEBUTTON, anti_str, (KeySym)XK_A,
462 XmVaCASCADEBUTTON, halo_str, (KeySym)XK_H,
463 XmVaCASCADEBUTTON, aux_edge_str, (KeySym)XK_E,
464 XtNvisual, vi -> visual,
465 XtNdepth, vi -> depth,
466 XtNcolormap, cmap,
467 XtNborderColor, borcol,
468 XtNbackground, bgnd,
469 NULL);
470
471 XmStringFree (trans_str);
472 XmStringFree (anti_str);
473 XmStringFree (halo_str);
474 XmStringFree (aux_edge_str);
475
476 // G4cout << "Created Special pulldown menu" << G4endl;
477
478 //Add Transparency pullright menu to special cascade...
479 off_str = XmStringCreateLocalized ((char*)"Off");
480 on_str = XmStringCreateLocalized ((char*)"On");
481
482 transparency_pullright = XmVaCreateSimplePulldownMenu
484 (char*)"transparency",
485 0,
487 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
488 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
489 XmNradioBehavior, True,
490 XmNradioAlwaysOne, True,
491 XmNuserData, this,
492 XtNvisual, vi -> visual,
493 XtNdepth, vi -> depth,
494 XtNcolormap, cmap,
495 XtNborderColor, borcol,
496 XtNbackground, bgnd,
497 NULL);
498
499 if (transparency_enabled == false) {
500 special_widget = XtNameToWidget(transparency_pullright, "button_0");
501 if(special_widget) {
502 XtVaSetValues (special_widget, XmNset, True, NULL);
503 }
504 } else if (transparency_enabled == true) {
505 special_widget = XtNameToWidget(transparency_pullright, "button_1");
506 if(special_widget) {
507 XtVaSetValues (special_widget, XmNset, True, NULL);
508 }
509 } else {
511 ("G4OpenGLXmViewer::CreateMainWindow",
512 "opengl2016", FatalException,
513 "transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
514 }
515
516 //Add antialias pullright menu to special cascade...
517 antialias_pullright = XmVaCreateSimplePulldownMenu
519 (char*)"antialias",
520 1,
522 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
523 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
524 XmNradioBehavior, True,
525 XmNradioAlwaysOne, True,
526 XmNuserData, this,
527 XtNvisual, vi -> visual,
528 XtNdepth, vi -> depth,
529 XtNcolormap, cmap,
530 XtNborderColor, borcol,
531 XtNbackground, bgnd,
532 NULL);
533
534 if (antialiasing_enabled == false) {
535 special_widget = XtNameToWidget(antialias_pullright, "button_0");
536 if(special_widget) {
537 XtVaSetValues (special_widget, XmNset, True, NULL);
538 }
539 } else if (antialiasing_enabled == true) {
540 special_widget = XtNameToWidget(antialias_pullright, "button_1");
541 if(special_widget) {
542 XtVaSetValues (special_widget, XmNset, True, NULL);
543 }
544 } else {
546 ("G4OpenGLXmViewer::CreateMainWindow",
547 "opengl2017", FatalException,
548 "antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
549 }
550
551 //Add Haloing pullright menu to special cascade...
552 haloing_pullright = XmVaCreateSimplePulldownMenu
554 (char*)"haloing",
555 2,
557 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
558 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
559 XmNradioBehavior, True,
560 XmNradioAlwaysOne, True,
561 XmNuserData, this,
562 XtNvisual, vi -> visual,
563 XtNdepth, vi -> depth,
564 XtNcolormap, cmap,
565 XtNborderColor, borcol,
566 XtNbackground, bgnd,
567 NULL);
568
569 if (haloing_enabled == false) {
570 special_widget = XtNameToWidget(haloing_pullright, "button_0");
571 if(special_widget) {
572 XtVaSetValues (special_widget, XmNset, True, NULL);
573 }
574 } else if (haloing_enabled == true) {
575 special_widget = XtNameToWidget(haloing_pullright, "button_1");
576 if(special_widget) {
577 XtVaSetValues (special_widget, XmNset, True, NULL);
578 }
579 } else {
581 ("G4OpenGLXmViewer::CreateMainWindow",
582 "opengl2018", FatalException,
583 "haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
584 }
585
586 //Add Aux_Edge pullright menu to special cascade...
587 aux_edge_pullright = XmVaCreateSimplePulldownMenu
589 (char*)"aux_edge",
590 3,
592 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
593 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
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_pullright, "button_0");
606 if(special_widget) {
607 XtVaSetValues (special_widget, XmNset, True, NULL);
608 }
609 } else {
610 special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
611 if(special_widget) {
612 XtVaSetValues (special_widget, XmNset, True, NULL);
613 }
614 }
615
616 XtManageChild (menubar);
617 frame = XtVaCreateManagedWidget ((char*)"frame",
618 xmFrameWidgetClass, main_win,
619 XtNvisual, vi -> visual,
620 XtNdepth, vi -> depth,
621 XtNcolormap, cmap,
622 XtNborderColor, borcol,
623 XtNbackground, bgnd,
624 NULL);
625
626 glxarea = XtVaCreateManagedWidget ((char*)"glxarea",
627 xmDrawingAreaWidgetClass,
628 frame,
629 XtNvisual, vi -> visual,
630 XtNdepth, vi -> depth,
631 XtNcolormap, cmap,
632 XtNborderColor, borcol,
633 XtNbackground, bgnd,
634 NULL);
635
636
637 XmMainWindowSetAreas (main_win, // main widget, children are specified
638 menubar, // widget to use as menu bar
639 NULL, // widget to use as command window
640 NULL, // widget for horizontal scroll bar
641 NULL, // widget for vertical scroll bar
642 frame // widget to be used for work window
643 );
644
645 XtRealizeWidget(shell);
646
647 // Once widget is realized (ie, associated with a created X window), we
648 // can bind the OpenGL rendering context to the window.
649
650 win = XtWindow (glxarea);
651
652 glXMakeCurrent (dpy, win, cxMaster);
653
654 // This should be add AFTER glXMakeCurrent done because it will fire a resizeCallback
655 XtAddCallback (glxarea,
656 XmNresizeCallback,
658 this);
659
660 XtAddCallback (glxarea,
661 XmNexposeCallback,
663 this);
664
665}
666
668G4VViewer (scene, -1),
669G4OpenGLViewer (scene),
670G4OpenGLXViewer (scene),
671toplevel (0),
672shell (0),
673main_win (0),
674menubar (0),
675style_cascade (0),
676actions_cascade (0),
677misc_cascade (0),
678spec_cascade (0),
679drawing_style_pullright (0),
680background_color_pullright (0),
681transparency_pullright (0),
682antialias_pullright (0),
683haloing_pullright (0),
684aux_edge_pullright (0),
685frame (0),
686glxarea (0),
687style_str (0),
688actions_str (0),
689misc_str (0),
690spec_str (0),
691draw_str (0),
692polyhedron_str (0),
693wireframe_str (0),
694hlr_str (0),
695hsr_str (0),
696hlhsr_str (0),
697set_str (0),
698rot_str (0),
699pan_str (0),
700exit_str (0),
701quit_str (0),
702print_str (0),
703white_str (0),
704black_str (0),
705anti_str (0),
706trans_str (0),
707halo_str (0),
708aux_edge_str (0),
709bgnd_str (0),
710off_str (0),
711on_str (0),
712zoom_high (0.0),
713zoom_low (0.0),
714pan_low (0.0),
715pan_high (0.0),
716dolly_low (0.0),
717dolly_high (0.0),
718fov (0.0),
719rot_sens_limit (0.0),
720pan_sens_limit (0.0),
721wob_high (0.0),
722wob_low (0.0),
723wob_sens (0.0),
724pan_right (false),
725rotate_right (false),
726pan_up (false),
727rotate_up (false),
728original_vp(fVP.GetViewpointDirection()),
729frameNo (0),
730fprotation_top (0),
731fprotation_button_box (0),
732fprotation_button1 (0),
733fprotation_button2 (0),
734fprotation_slider_box (0),
735fprotation_slider (0),
736fprotation_arrow_box (0),
737fprotation_arrow (0),
738fppanning_top (0),
739fppanning_box (0),
740fppanning_arrows (0),
741fppanning_slider (0),
742fpzoom_box (0),
743fpzoom_slider (0),
744fpdolly_box (0),
745fpdolly_slider (0),
746fpsetting_top (0),
747fpsetting_box (0),
748fppan_set (0),
749fprot_set (0),
750fpzoom_upper (0),
751fpzoom_lower (0),
752fpdolly_upper (0),
753fpdolly_lower (0),
754fpok_button (0),
755fpmiscellany_top (0),
756fpwobble_box (0),
757fpwobble_button (0),
758fpwobble_slider (0),
759fpreset_box (0),
760fpreset_button (0),
761fpproj_style_box (0),
762fporthogonal_button (0),
763fpperspective_button (0),
764fpfov_text (0),
765fpprint_top (0),
766fpprint_box (0),
767fpprint_col_box (0),
768fpprint_style_box (0),
769fpprint_text (0),
770fpprint_button (0),
771fpprint_line (0),
772fpprint_col_radio1 (0),
773fpprint_col_radio2 (0),
774fpprint_style_radio1 (0),
775fpprint_style_radio2 (0)
776{
778 ResetView();
779 if (fViewId < 0) return;
780}
781
782
784
785 // set new values
786
787 if (fprotation_slider) {
791 }
792 if (fppanning_slider) {
796 }
797 if (fpzoom_slider) {
801 }
802 if (fpdolly_slider) {
806 }
807
808 if (fpwobble_slider) {
810 }
811
812 if (fppan_set) {
814 }
815
816 if (fprot_set) {
818 }
819
820 if (fpzoom_upper) {
822 }
823
824 if (fpzoom_lower) {
826 }
827 if (fpdolly_upper) {
829 }
830
831 if (fpdolly_lower) {
833 }
834
835
836}
837
838
840{
841 XtDestroyWidget (shell);
842 win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
843 // because XtDestroyWidget has already destroyed it.
845
846/******************************
847 if (fprotation_top) {
848 delete fprotation_top;
849 }
850
851 if (fppanning_top) {
852 delete fppanning_top;
853 }
854
855 if (fpsetting_top) {
856 delete fpsetting_top;
857 }
858
859 if (fpmiscellany_top) {
860 delete fpmiscellany_top;
861 }
862******************************/
863
864}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
G4bool antialiasing_enabled
G4bool transparency_enabled
XVisualInfo * vi
friend class G4OpenGLXmViewer
GLXContext cxMaster
void SetInitialValue(G4double)
virtual void ShowView()
static void background_color_callback(Widget w, XtPointer clientData, XtPointer callData)
static void antialias_callback(Widget w, XtPointer clientData, XtPointer callData)
G4OpenGLXmSliderBar * fppanning_slider
static void drawing_style_callback(Widget w, XtPointer clientData, XtPointer callData)
G4OpenGLXmSliderBar * fprotation_slider
G4OpenGLXmTextField * fprot_set
static void resize_callback(Widget w, XtPointer clientData, XtPointer callData)
static void haloing_callback(Widget w, XtPointer clientData, XtPointer callData)
static void expose_callback(Widget w, XtPointer clientData, XtPointer callData)
static void aux_edge_callback(Widget w, XtPointer clientData, XtPointer callData)
G4OpenGLXmTextField * fpdolly_lower
G4OpenGLXmTextField * fpzoom_lower
virtual ~G4OpenGLXmViewer()
Widget drawing_style_pullright
G4OpenGLXmTextField * fpdolly_upper
G4OpenGLXmSliderBar * fpwobble_slider
G4OpenGLXmSliderBar * fpzoom_slider
static void misc_callback(Widget w, XtPointer clientData, XtPointer callData)
virtual void CreateMainWindow()
G4OpenGLXmSliderBar * fpdolly_slider
G4OpenGLXmTextField * fpzoom_upper
Widget background_color_pullright
static void actions_callback(Widget w, XtPointer clientData, XtPointer callData)
static void transparency_callback(Widget w, XtPointer clientData, XtPointer callData)
G4OpenGLXmTextField * fppan_set
const G4VisExtent & GetExtent() const
G4Interactor GetMainInteractor()
void RemoveShell(G4Interactor)
void AddShell(G4Interactor)
G4Scene * GetScene() const
G4String fName
Definition: G4VViewer.hh:217
G4int fViewId
Definition: G4VViewer.hh:216
G4ViewParameters fVP
Definition: G4VViewer.hh:219
G4VSceneHandler * GetSceneHandler() const
bool IsWindowLocationHintY() const
G4int GetWindowAbsoluteLocationHintY(G4int) const
bool IsWindowLocationHintX() const
unsigned int GetWindowSizeHintX() const
bool IsWindowSizeHintX() const
G4double GetZoomFactor() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
G4double GetDolly() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
Definition: G4Xt.hh:48
static G4Xt * getInstance()
Definition: G4Xt.cc:55
void PutStringInResourceDatabase(char *)
Definition: G4Xt.cc:162