Changeset 1037 for trunk/source/visualization
- Timestamp:
- May 11, 2009, 11:55:23 AM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/include/G4OpenGLViewer.hh
r975 r1037 65 65 void HLRThirdPass (); 66 66 void InitializeGLView (); 67 void ResizeGLView( );67 void ResizeGLView(unsigned int, unsigned int); 68 68 void Pick(GLdouble x, GLdouble y); 69 69 virtual void CreateFontLists () {} … … 71 71 //////////////////////////////Vectored PostScript production functions/// 72 72 void printEPS(); 73 // print EPS file. Depending of fVectoredPs, it will print Vectored or not 74 73 // print EPS file. Depending of fVectoredPs, it will print Vectored or not 74 75 unsigned int getWinWidth(); 76 unsigned int getWinHeight(); 75 77 GLdouble getSceneNearWidth(); 76 78 GLdouble getSceneFarWidth(); … … 84 86 G4OpenGLSceneHandler& fOpenGLSceneHandler; 85 87 G4Colour background; //the OpenGL clear colour 86 unsigned int fWinSize_x, fWinSize_y;87 // size of the OpenGL frame88 88 G4bool 89 89 transparency_enabled, //is alpha blending enabled? … … 105 105 G4float fPointSize; 106 106 bool printGl2PS(); 107 void ResizeGLView(); 107 108 GLubyte* grabPixels (int inColor, 108 109 unsigned int width, … … 113 114 bool printVectoredEPS(); 114 115 // print vectored EPS files 116 unsigned int fWinSize_x, fWinSize_y; 117 // size of the OpenGL frame 115 118 }; 116 119 -
trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
r976 r1037 119 119 120 120 #ifdef G4DEBUG_VIS_OGL 121 printf("G4OpenGLImmediateQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",fWinSize_x, fWinSize_y);121 printf("G4OpenGLImmediateQtViewer::ComputeView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n"); 122 122 #endif 123 123 makeCurrent(); … … 150 150 151 151 #ifdef G4DEBUG_VIS_OGL 152 printf("G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",fWinSize_x, fWinSize_y);152 printf("G4OpenGLImmediateQtViewer::ComputeView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n"); 153 153 #endif 154 154 hasToRepaint = true; … … 175 175 ,int aHeight) 176 176 { 177 fWinSize_x = aWidth; 178 fWinSize_y = aHeight; 179 hasToRepaint = true; 177 ResizeGLView(aWidth,aHeight); 178 // hasToRepaint = true; 180 179 } 181 180 … … 191 190 } 192 191 // DO NOT RESIZE IF SIZE HAS NOT CHANGE 193 if ( !hasToRepaint) {194 if (((fWinSize_x == (unsigned int)width())) &&(fWinSize_y == (unsigned int) height())) {195 return;196 }197 }192 // if ( !hasToRepaint) { 193 // if (((fWinSize_x == (unsigned int)width())) &&(fWinSize_y == (unsigned int) height())) { 194 // return; 195 // } 196 // } 198 197 #ifdef G4DEBUG_VIS_OGL 199 198 printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint); -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1036 r1037 173 173 GLWindow->setWindowTitle( name); 174 174 #endif 175 fWinSize_x = fVP.GetWindowSizeHintX();176 fWinSize_y = fVP.GetWindowSizeHintY();177 175 178 176 //useful for MACOSX, we have to compt the menuBar height … … 184 182 YPos = offset; 185 183 } 186 GLWindow->resize(fWinSize_x, fWinSize_y);184 // ResizeGLView(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY()); 187 185 GLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos); 188 186 GLWindow->show(); … … 1563 1561 GLdouble coefDepth = 0; 1564 1562 if(mouseMove) { 1565 coefTrans = ((G4double)getSceneNearWidth())/((G4double) fWinSize_x);1566 if ( fWinSize_y <fWinSize_x) {1567 coefTrans = ((G4double)getSceneNearWidth())/((G4double) fWinSize_y);1563 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinWidth()); 1564 if (getWinHeight() <getWinWidth()) { 1565 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinHeight()); 1568 1566 } 1569 1567 } else { -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r976 r1037 126 126 127 127 #ifdef G4DEBUG_VIS_OGL 128 printf("G4OpenGLStoredQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",fWinSize_x, fWinSize_y);128 printf("G4OpenGLStoredQtViewer::ComputeView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n"); 129 129 #endif 130 130 makeCurrent(); … … 195 195 196 196 #ifdef G4DEBUG_VIS_OGL 197 printf("G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",fWinSize_x, fWinSize_y);197 printf("G4OpenGLStoredQtViewer::ComputeView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n"); 198 198 #endif 199 199 hasToRepaint =true; … … 209 209 { 210 210 // Set new size, it will be update when next Repaint()->SetView() called 211 fWinSize_x = aWidth; 212 fWinSize_y = aHeight; 213 hasToRepaint = true; 211 ResizeGLView(aWidth,aHeight); 212 // hasToRepaint = true; 214 213 } 215 214 … … 227 226 // WHEN CLICK ON THE FRAME FOR EXAMPLE 228 227 // EXECEPT WHEN MOUSE MOVE EVENT 229 if ( !hasToRepaint) {230 if (((fWinSize_x == (unsigned int)width())) &&(fWinSize_y == (unsigned int) height())) {231 return;232 }233 }228 // if ( !hasToRepaint) { 229 // if (((fWinSize_x == (unsigned int)width())) &&(fWinSize_y == (unsigned int) height())) { 230 // return; 231 // } 232 // } 234 233 #ifdef G4DEBUG_VIS_OGL 235 234 printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r1036 r1037 135 135 136 136 137 void G4OpenGLViewer::ResizeGLView(unsigned int aWidth,unsigned int aHeight) 138 { 139 if ((fWinSize_x != aWidth) && (fWinSize_y != aHeight)) { 140 fWinSize_x = aWidth; 141 fWinSize_y = aHeight; 142 ResizeGLView(); 143 } 144 } 145 146 137 147 /** 138 148 * Set the viewport of the scene … … 196 206 197 207 208 unsigned int G4OpenGLViewer::getWinWidth () { 209 return fWinSize_x; 210 } 211 212 unsigned int G4OpenGLViewer::getWinHeight () { 213 return fWinSize_y; 214 } 215 216 198 217 void G4OpenGLViewer::SetView () { 199 218 … … 241 260 242 261 // FIXME 243 ResizeGLView( );262 ResizeGLView(fWinSize_x,fWinSize_y); 244 263 //SHOULD SetWindowsSizeHint()... 245 264 … … 631 650 int Y = fWinSize_y; 632 651 633 fWinSize_x = width; 634 fWinSize_y = height; 635 ResizeGLView(); 652 ResizeGLView(width,height); 636 653 if (fGL2PSAction->enableFileWriting()) { 637 654 … … 645 662 } 646 663 647 fWinSize_x = X; 648 fWinSize_y = Y; 649 ResizeGLView(); 664 ResizeGLView(X,Y); 650 665 651 666 // Reset for next time (useful is size change) -
trunk/source/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
r977 r1037 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.cc,v 1.1 6 2009/03/18 14:34:28allison Exp $27 // $Id: G4OpenGLViewerMessenger.cc,v 1.17 2009/04/28 15:05:22 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 … … 274 274 if (newValue == "vectored") pOGLViewer->fVectoredPs = true; 275 275 if (newValue == "pixmap") pOGLViewer->fVectoredPs = false; 276 return; 276 277 } 277 278 … … 281 282 if (pOGLViewer->fVP.IsAutoRefresh()) 282 283 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh"); 284 return; 283 285 } 284 286 … … 286 288 dynamic_cast<G4OpenGLStoredViewer*>(pViewer); 287 289 288 if (!pOGLSViewer) { 289 G4cout << 290 if (!pOGLSViewer) 291 { 292 G4cout << 290 293 "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS." 291 294 "\n The time slice viewing feature is only implemented for OGL Stored" 292 295 "\n viewers at present. Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"." 293 294 return;295 }296 << G4endl; 297 return; 298 } 296 299 297 300 if (command == fpCommandDisplayHeadTime) … … 309 312 pOGLSViewer->fDisplayHeadTimeGreen = green; 310 313 pOGLSViewer->fDisplayHeadTimeBlue = blue; 314 return; 311 315 } 312 316 … … 332 336 pOGLSViewer->fDisplayLightFrontGreen = green; 333 337 pOGLSViewer->fDisplayLightFrontBlue = blue; 338 return; 334 339 } 335 340 … … 350 355 if (pOGLSViewer->fVP.IsAutoRefresh()) 351 356 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh"); 357 return; 352 358 } 353 359 … … 375 381 if (pOGLSViewer->fVP.IsAutoRefresh()) 376 382 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh"); 383 return; 377 384 } 378 385 -
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r1036 r1037 231 231 size_hints = XAllocSizeHints(); 232 232 233 fWinSize_x = fVP.GetWindowSizeHintX();234 fWinSize_y = fVP.GetWindowSizeHintY();235 233 G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen)); 236 234 … … 239 237 G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen)); 240 238 241 size_hints->base_width = fWinSize_x;242 size_hints->base_height = fWinSize_y;239 size_hints->base_width = getWinWidth(); 240 size_hints->base_height = getWinHeight(); 243 241 size_hints->x = x_origin; 244 242 size_hints->y = y_origin; … … 270 268 271 269 win = XCreateWindow (dpy, XRootWindow (dpy, vi -> screen), x_origin, 272 y_origin, fWinSize_x, fWinSize_y, 0, vi -> depth,270 y_origin, getWinWidth(), getWinHeight(), 0, vi -> depth, 273 271 InputOutput, vi -> visual, 274 272 CWBorderPixel | CWColormap | -
trunk/source/visualization/OpenGL/src/G4OpenGLXmViewer.cc
r1036 r1037 146 146 borcol = XBlackPixelOfScreen (XtScreen(shell)); 147 147 148 fWinSize_x = fVP.GetWindowSizeHintX();149 fWinSize_y = fVP.GetWindowSizeHintY();150 148 G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen)); 151 149 … … 159 157 XtNdepth, vi -> depth, 160 158 XtNcolormap, cmap, 161 XtNwidth, fWinSize_x,162 XtNheight, fWinSize_y,159 XtNwidth, getWinWidth(), 160 XtNheight, getWinHeight(), 163 161 XtNx, x_origin, 164 162 XtNy, y_origin, … … 172 170 XtNdepth, vi -> depth, 173 171 XtNcolormap, cmap, 174 XtNwidth, fWinSize_x,175 XtNheight, fWinSize_y,172 XtNwidth, getWinWidth(), 173 XtNheight, getWinHeight(), 176 174 XtNborderColor, &borcol, 177 175 XtNbackground, &bgnd, -
trunk/source/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r1036 r1037 62 62 NULL); 63 63 64 pView->fWinSize_x = (G4int) width; 65 pView->fWinSize_y = (G4int) height; 64 pView->ResizeGLView((G4int) width,(G4int) height); 66 65 67 66 glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cx); … … 70 69 printf("G4OpenGLXmViewer::expose_callback\n"); 71 70 #endif 72 pView->SetView (); 73 // pView->ClearView (); 71 // FIXME : L.Garnier 11 Mai 2009 : Should be erase 72 pView->SetView (); 73 pView->ClearView (); 74 74 pView->DrawView (); 75 // ENDOF Fixme 76 75 77 } 76 78
Note: See TracChangeset
for help on using the changeset viewer.