Changeset 1346 for trunk/source/visualization/OpenGL/src
- Timestamp:
- Dec 22, 2010, 11:33:38 AM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL/src
- Files:
-
- 9 edited
-
CVS/Entries (modified) (1 diff)
-
CVS/Tag (modified) (1 diff)
-
G4OpenGLQtViewer.cc (modified) (5 diffs)
-
G4OpenGLSceneHandler.cc (modified) (3 diffs)
-
G4OpenGLStoredSceneHandler.cc (modified) (22 diffs)
-
G4OpenGLStoredViewer.cc (modified) (2 diffs)
-
G4OpenGLStoredXmViewer.cc (modified) (1 diff)
-
G4OpenGLViewer.cc (modified) (3 diffs)
-
G4OpenGLXViewer.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/CVS/Entries
r1343 r1346 1 /G4OpenGL Viewer.cc/1.63/Tue Oct 5 15:45:19 2010//2 /G4OpenGL BitMapStore.cc/1.5/Mon Jan 19 16:53:42 2009//3 /G4OpenGL FontBaseStore.cc/1.4/Mon Jan 19 16:53:42 2009//4 /G4OpenGLImmediateQt .cc/1.6/Wed Feb 4 16:48:41 2009//5 /G4OpenGLImmediate QtViewer.cc/1.22/Wed Jun 23 13:29:23 2010//6 /G4OpenGLImmediate SceneHandler.cc/1.35/Thu Jun 3 20:35:19 2010//7 /G4OpenGLImmediate Viewer.cc/1.10/Wed Feb 4 16:48:41 2009//8 /G4OpenGLImmediateWin32 .cc/1.13/Wed May 20 09:58:10 2009//9 /G4OpenGLImmediate Win32Viewer.cc/1.19/Wed May 20 10:19:51 2009//10 /G4OpenGLImmediateX .cc/1.15/Wed Feb 4 16:48:41 2009//11 /G4OpenGLImmediateX Viewer.cc/1.19/Wed Feb 4 16:48:41 2009//12 /G4OpenGLImmediateXm .cc/1.15/Wed Feb 4 16:48:41 2009//13 /G4OpenGL ImmediateXmViewer.cc/1.21/Wed Apr 8 16:55:44 2009//14 /G4OpenGLQt ExportDialog.cc/1.9/Fri Oct 24 14:17:10 2008//15 /G4OpenGLQt MovieDialog.cc/1.8/Fri Oct 24 13:49:19 2008//16 /G4OpenGL QtViewer.cc/1.55/Fri Oct 8 10:07:31 2010//17 /G4OpenGLS ceneHandler.cc/1.59/Sun May 30 09:53:05 2010//18 /G4OpenGLStoredQt .cc/1.10/Mon Jan 19 16:26:40 2009//19 /G4OpenGLStored QtViewer.cc/1.32/Mon Nov 8 11:03:16 2010//20 /G4OpenGLStored SceneHandler.cc/1.44/Sat Nov 6 12:09:41 2010//21 /G4OpenGLStored Viewer.cc/1.29/Wed Oct 6 10:05:52 2010//22 /G4OpenGLStoredWin32 .cc/1.15/Mon Jan 19 16:53:42 2009//23 /G4OpenGLStored Win32Viewer.cc/1.22/Wed May 20 13:19:09 2009//24 /G4OpenGLStoredX .cc/1.15/Mon Jan 19 16:53:42 2009//25 /G4OpenGLStoredX Viewer.cc/1.27/Thu Jun 3 08:26:55 2010//26 /G4OpenGLStoredXm .cc/1.12/Mon Jan 19 16:53:42 2009//27 /G4OpenGL StoredXmViewer.cc/1.26/Fri Apr 30 13:18:32 2010//28 /G4OpenGL Transform3D.cc/1.9/Mon Jan 19 16:53:42 2009//29 /G4OpenGLViewerMessenger.cc/1.21/Sun Nov 7 10:31:26 2010// 30 /G4OpenGLWin32Viewer.cc/1.20/Wed May 20 13:19:09 2009// 31 /G4OpenGLXViewer.cc/1.5 5/Wed May 13 10:28:00 2009//32 /G4OpenGLXmBox.cc/1.8/Wed Feb 4 16:48:41 2009// 33 /G4OpenGLXmConvenienceRoutines.cc/1.13/Wed Feb 4 16:48:41 2009// 34 /G4OpenGLXmFourArrowButtons.cc/1.7/Wed Feb 4 16:48:41 2009// 35 /G4OpenGLXmFramedBox.cc/1.8/Wed Feb 4 16:48:41 2009// 36 /G4OpenGLXmMainMenubarCallbacks.cc/1.18/Tue Oct 20 12:47:45 2009// 37 /G4OpenGLXmPanningCallbacks.cc/1.12/Tue Nov 3 10:21:49 2009// 38 /G4OpenGLXmPushButton.cc/1.8/Wed Feb 4 16:48:41 2009// 39 /G4OpenGLXmRadioButton.cc/1.8/Wed Feb 4 16:48:41 2009// 40 /G4OpenGLXmRotationCallbacks.cc/1.17/Mon Jan 19 16:53:42 2009// 41 /G4OpenGLXmSeparator.cc/1.7/Wed Feb 4 16:48:41 2009// 42 /G4OpenGLXmSliderBar.cc/1.8/Mon Jan 19 16:53:42 2009// 43 /G4OpenGLXmStyleCallbacks.cc/1.15/Mon Jan 19 16:53:42 2009// 44 /G4OpenGLXmTextField.cc/1.9/Wed Feb 4 16:48:41 2009// 45 /G4OpenGLXmTopLevelShell.cc/1.7/Wed Feb 4 16:48:41 2009// 46 /G4OpenGLXmVWidgetComponent.cc/1.6/Mon Jan 19 16:53:42 2009// 47 /G4OpenGLXmVWidgetContainer.cc/1.7/Fri Mar 13 09:50:03 2009// 48 /G4OpenGLXmVWidgetObject.cc/1.7/ Wed Feb 4 16:48:41 2009//49 /G4OpenGLXmVWidgetShell.cc/1.6/Mon Jan 19 16:53:42 2009// 50 /G4OpenGLXmViewer.cc/1.31/Wed May 13 10:28:00 2009// 51 /G4OpenGLXmViewerMessenger.cc/1.5/Mon Jan 19 16:53:42 2009// 52 /G4OpenGLXmWindowHandlingCallbacks.cc/1.11/ Mon Nov 8 11:03:16 2010//1 /G4OpenGLBitMapStore.cc/1.5/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 2 /G4OpenGLFontBaseStore.cc/1.4/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 3 /G4OpenGLImmediateQt.cc/1.6/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 4 /G4OpenGLImmediateQtViewer.cc/1.22/Wed Jun 23 13:29:23 2010//Tgeant4-09-04-ref-00 5 /G4OpenGLImmediateSceneHandler.cc/1.35/Thu Jun 3 20:35:19 2010//Tgeant4-09-04-ref-00 6 /G4OpenGLImmediateViewer.cc/1.10/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 7 /G4OpenGLImmediateWin32.cc/1.13/Wed May 20 09:58:10 2009//Tgeant4-09-04-ref-00 8 /G4OpenGLImmediateWin32Viewer.cc/1.19/Wed May 20 10:19:51 2009//Tgeant4-09-04-ref-00 9 /G4OpenGLImmediateX.cc/1.15/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 10 /G4OpenGLImmediateXViewer.cc/1.19/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 11 /G4OpenGLImmediateXm.cc/1.15/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 12 /G4OpenGLImmediateXmViewer.cc/1.21/Wed Apr 8 16:55:44 2009//Tgeant4-09-04-ref-00 13 /G4OpenGLQtExportDialog.cc/1.9/Fri Oct 24 14:17:10 2008//Tgeant4-09-04-ref-00 14 /G4OpenGLQtMovieDialog.cc/1.8/Fri Oct 24 13:49:19 2008//Tgeant4-09-04-ref-00 15 /G4OpenGLQtViewer.cc/1.55/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 16 /G4OpenGLSceneHandler.cc/1.59/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 17 /G4OpenGLStoredQt.cc/1.10/Mon Jan 19 16:26:40 2009//Tgeant4-09-04-ref-00 18 /G4OpenGLStoredQtViewer.cc/1.32/Mon Dec 6 16:50:27 2010//Tgeant4-09-04-ref-00 19 /G4OpenGLStoredSceneHandler.cc/1.46/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 20 /G4OpenGLStoredViewer.cc/1.29/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 21 /G4OpenGLStoredWin32.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 22 /G4OpenGLStoredWin32Viewer.cc/1.22/Wed May 20 13:19:09 2009//Tgeant4-09-04-ref-00 23 /G4OpenGLStoredX.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 24 /G4OpenGLStoredXViewer.cc/1.27/Thu Jun 3 08:26:55 2010//Tgeant4-09-04-ref-00 25 /G4OpenGLStoredXm.cc/1.12/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 26 /G4OpenGLStoredXmViewer.cc/1.26/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 27 /G4OpenGLTransform3D.cc/1.9/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 28 /G4OpenGLViewer.cc/1.63/dummy timestamp from new-entry//Tgeant4-09-04-ref-00 29 /G4OpenGLViewerMessenger.cc/1.21/Sun Nov 7 10:31:26 2010//Tgeant4-09-04-ref-00 30 /G4OpenGLWin32Viewer.cc/1.20/Wed May 20 13:19:09 2009//Tgeant4-09-04-ref-00 31 /G4OpenGLXViewer.cc/1.56/Result of merge//Tgeant4-09-04-ref-00 32 /G4OpenGLXmBox.cc/1.8/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 33 /G4OpenGLXmConvenienceRoutines.cc/1.13/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 34 /G4OpenGLXmFourArrowButtons.cc/1.7/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 35 /G4OpenGLXmFramedBox.cc/1.8/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 36 /G4OpenGLXmMainMenubarCallbacks.cc/1.18/Tue Oct 20 12:47:45 2009//Tgeant4-09-04-ref-00 37 /G4OpenGLXmPanningCallbacks.cc/1.12/Tue Nov 3 10:21:49 2009//Tgeant4-09-04-ref-00 38 /G4OpenGLXmPushButton.cc/1.8/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 39 /G4OpenGLXmRadioButton.cc/1.8/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 40 /G4OpenGLXmRotationCallbacks.cc/1.17/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 41 /G4OpenGLXmSeparator.cc/1.7/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 42 /G4OpenGLXmSliderBar.cc/1.8/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 43 /G4OpenGLXmStyleCallbacks.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 44 /G4OpenGLXmTextField.cc/1.9/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 45 /G4OpenGLXmTopLevelShell.cc/1.7/Wed Feb 4 16:48:41 2009//Tgeant4-09-04-ref-00 46 /G4OpenGLXmVWidgetComponent.cc/1.6/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 47 /G4OpenGLXmVWidgetContainer.cc/1.7/Fri Mar 13 09:50:03 2009//Tgeant4-09-04-ref-00 48 /G4OpenGLXmVWidgetObject.cc/1.7/Mon Dec 6 17:36:26 2010//Tgeant4-09-04-ref-00 49 /G4OpenGLXmVWidgetShell.cc/1.6/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 50 /G4OpenGLXmViewer.cc/1.31/Wed May 13 10:28:00 2009//Tgeant4-09-04-ref-00 51 /G4OpenGLXmViewerMessenger.cc/1.5/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00 52 /G4OpenGLXmWindowHandlingCallbacks.cc/1.11/Wed May 13 10:28:00 2009//Tgeant4-09-04-ref-00 53 53 D -
trunk/source/visualization/OpenGL/src/CVS/Tag
r1331 r1346 1 Ngeant4-09-04- beta-011 Ngeant4-09-04-ref-00 -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1340 r1346 195 195 if (!fContextMenu) 196 196 createPopupMenu(); 197 198 //dummy call to init Text display list 199 drawText("",0,0,0,10); 197 200 198 201 } … … 274 277 275 278 279 void G4OpenGLQtViewer::drawText(const char * textString,int x,int y,int z, int size) { 280 if (!fWindow) 281 return; 282 QFont font = QFont(); 283 font.setPointSize(size); 284 285 // gl2ps or GL window ? 286 int fontsize=font.pixelSize(); 287 if(font.pointSize() > fontsize) { 288 fontsize = font.pointSize(); 289 } 290 #ifdef G4DEBUG_VIS_OGL 291 printf("G4OpenGLQtViewer::drawText :: renderText.............. \n"); 292 #endif 293 if (! drawGl2psText(textString,fontsize)) { 294 fWindow->renderText(x,y,z, textString,font); 295 } 296 } 297 298 299 276 300 /** 277 301 Create a popup menu for the widget. This menu is activated by right-mouse click … … 1474 1498 { 1475 1499 glFlush (); 1476 1477 1500 // L. Garnier 10/2009 : Not necessary and cause problems on mac OS X 10.6 1478 1501 // fWindow->swapBuffers (); … … 1517 1540 // try to addapt speed move/rotate looking to drawing speed 1518 1541 float correctionFactor = 5; 1542 float globalTime = 0; 1543 float globalRun = 0; 1519 1544 while (fAutoMove) { 1520 1545 if ( lastMoveTime.elapsed () >= (int)(1000/fNbMaxFramesPerSec)) { … … 1552 1577 moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true); 1553 1578 } 1579 //#ifdef G4DEBUG_VIS_OGL 1580 globalTime += (float)lastMoveTime.elapsed (); 1581 globalRun +=1; 1582 printf("G4OpenGLQtViewer::CreateMainWindow :: time/per run :%f run:%f %f\n",globalTime/globalRun,globalRun,globalTime); 1583 //#endif 1554 1584 lastMoveTime.start(); 1555 1585 } -
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r1343 r1346 46 46 #include "G4OpenGLSceneHandler.hh" 47 47 #include "G4OpenGLViewer.hh" 48 #include "G4OpenGLFontBaseStore.hh" 48 #include "G4OpenGLQtViewer.hh" 49 #include "G4OpenGLXViewer.hh" 49 50 #include "G4OpenGLTransform3D.hh" 50 51 #include "G4Point3D.hh" … … 268 269 G4String textString = text.GetText(); 269 270 270 G4int font_base = G4OpenGLFontBaseStore::GetFontBase(fpViewer,size);271 if (font_base < 0) {272 static G4int callCount = 0;273 ++callCount;274 if (callCount <= 10 || callCount%100 == 0) {275 G4cout <<276 "G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count "277 << callCount <<278 "\n No fonts available."279 "\n Called with text \""280 << text.GetText ()281 << "\"\n at " << position282 << ", size " << size283 << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()284 << ", type " << G4int(sizeType)285 << ", colour " << c286 << G4endl;287 }288 return;289 }290 271 const char* textCString = textString.c_str(); 272 GLfloat color[4]; /* Ask OpenGL for the current color */ 273 glGetFloatv(GL_CURRENT_COLOR, color); 291 274 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 292 275 glDisable (GL_DEPTH_TEST); … … 294 277 295 278 glRasterPos3d(position.x(),position.y(),position.z()); 296 // No action on offset or layout at present. 297 glPushAttrib(GL_LIST_BIT); 298 glListBase(font_base); 299 glCallLists(strlen(textCString), GL_UNSIGNED_BYTE, (GLubyte *)textCString); 300 glPopAttrib(); 279 //FIXME : We should do a virtual method drawText in all viewers 280 // Not the same way to draw text in Qt 281 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER 282 G4OpenGLQtViewer* pQtViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer); 283 if (pQtViewer) { 284 pQtViewer->drawText(textCString,position.x(),position.y(),position.z(),size); 285 } 286 #endif 287 288 // nor for X 289 #ifdef G4VIS_BUILD_OPENGLX_DRIVER 290 G4OpenGLXViewer* pXViewer = dynamic_cast<G4OpenGLXViewer*>(fpViewer); 291 if (pXViewer) { 292 293 pXViewer->drawText(textCString,position.x(),position.y(),position.z(),size); 294 } 295 #endif 296 glColor3d (color[0], color[1], color[2]); 297 301 298 } 302 299 -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r1343 r1346 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.4 4 2010/11/06 12:09:41allison Exp $27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.46 2010/11/10 17:11:20 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 105 105 if (fMemoryForDisplayLists) { 106 106 fDisplayListId = glGenLists (1); 107 #ifdef G4DEBUG_VIS_OGL 108 printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->glGenList(1) : %d readyForTranscient:%d\n",fDisplayListId,fReadyForTransients); 109 #endif 107 110 if (glGetError() == GL_OUT_OF_MEMORY || 108 fDisplayListId > fDisplayListLimit + fDisplayListBase) {111 fDisplayListId > fDisplayListLimit) { 109 112 G4cout << 110 "********************* WARNING! ********************" 111 "\n Display list limit reached in OpenGL." 112 "\n Continuing drawing in IMMEDIATE MODE." 113 "\n Current limit: " 114 << fDisplayListLimit << 115 ". Change with \"/vis/ogl/set/displayListLimit\"." 116 "\n***************************************************" 113 "********************* WARNING! ********************" 114 "\n* Display list limit reached in OpenGL." 115 "\n* Continuing drawing WITHOUT STORING. Scene only partially refreshable." 116 "\n* Current limit: " << fDisplayListLimit << 117 ". Change with \"/vis/ogl/set/displayListLimit\"." 118 "\n***************************************************" 117 119 << G4endl; 118 120 fMemoryForDisplayLists = false; … … 128 130 to.fStartTime = pVA->GetStartTime(); 129 131 to.fEndTime = pVA->GetEndTime(); 132 #ifdef G4DEBUG_VIS_OGL 133 printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->fTOList puch_back\n"); 134 #endif 130 135 fTOList.push_back(to); 131 136 glDrawBuffer (GL_FRONT); 137 #ifdef G4DEBUG_VIS_OGL 138 printf("+1\n"); 139 #endif 132 140 glPushMatrix(); 133 141 G4OpenGLTransform3D oglt (*fpObjectTransformation); … … 139 147 PO po(fDisplayListId, *fpObjectTransformation); 140 148 po.fPickName = fPickName; 149 #ifdef G4DEBUG_VIS_OGL 150 printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->fPOList puch_back\n"); 151 #endif 141 152 fPOList.push_back(po); 142 153 glNewList (fDisplayListId, GL_COMPILE); … … 145 156 } else { 146 157 glDrawBuffer (GL_FRONT); 158 #ifdef G4DEBUG_VIS_OGL 159 printf("+2\n"); 160 #endif 147 161 glPushMatrix(); 148 162 G4OpenGLTransform3D oglt (*fpObjectTransformation); … … 155 169 // coordinates... 156 170 glMatrixMode (GL_PROJECTION); 171 #ifdef G4DEBUG_VIS_OGL 172 printf("+3\n"); 173 #endif 157 174 glPushMatrix(); 158 175 glLoadIdentity(); 159 176 glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG); 160 177 glMatrixMode (GL_MODELVIEW); 178 #ifdef G4DEBUG_VIS_OGL 179 printf("+4\n"); 180 #endif 161 181 glPushMatrix(); 162 182 glLoadIdentity(); … … 172 192 // Pop current 3D world matrices back again... 173 193 glMatrixMode (GL_PROJECTION); 194 #ifdef G4DEBUG_VIS_OGL 195 printf("-1\n"); 196 #endif 174 197 glPopMatrix(); 175 198 glMatrixMode (GL_MODELVIEW); 199 #ifdef G4DEBUG_VIS_OGL 200 printf("-2\n"); 201 #endif 176 202 glPopMatrix(); 177 203 } … … 194 220 } 195 221 if (fReadyForTransients || !fMemoryForDisplayLists) { 222 #ifdef G4DEBUG_VIS_OGL 223 printf("-3\n"); 224 #endif 196 225 glPopMatrix(); 197 226 glFlush (); … … 203 232 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline) 204 233 { 234 #ifdef G4DEBUG_VIS_OGL 235 printf("G4OpenGLStoredSceneHandler::AddPrimitive polyline\n"); 236 // if (glIsList(7)) return; 237 #endif 205 238 AddPrimitivePreamble(polyline); 206 239 G4OpenGLSceneHandler::AddPrimitive(polyline); … … 210 243 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 211 244 { 245 #ifdef G4DEBUG_VIS_OGL 246 printf("G4OpenGLStoredSceneHandler::AddPrimitive polymarker\n"); 247 if (glIsList(7)) return; 248 #endif 212 249 AddPrimitivePreamble(polymarker); 213 250 G4OpenGLSceneHandler::AddPrimitive(polymarker); … … 220 257 // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still 221 258 // gets into the display list 259 #ifdef G4DEBUG_VIS_OGL 260 printf("G4OpenGLStoredSceneHandler::AddPrimitive Text\n"); 261 #endif 222 262 AddPrimitivePreamble(text); 223 263 G4OpenGLSceneHandler::AddPrimitive(text); … … 227 267 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle) 228 268 { 269 #ifdef G4DEBUG_VIS_OGL 270 printf("G4OpenGLStoredSceneHandler::AddPrimitive circle\n"); 271 #endif 229 272 AddPrimitivePreamble(circle); 230 273 G4OpenGLSceneHandler::AddPrimitive(circle); … … 234 277 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square) 235 278 { 279 #ifdef G4DEBUG_VIS_OGL 280 printf("G4OpenGLStoredSceneHandler::AddPrimitive square\n"); 281 #endif 236 282 AddPrimitivePreamble(square); 237 283 G4OpenGLSceneHandler::AddPrimitive(square); … … 250 296 // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still 251 297 // gets into the display list 298 #ifdef G4DEBUG_VIS_OGL 299 printf("G4OpenGLStoredSceneHandler::AddPrimitive polyhedron\n"); 300 #endif 252 301 AddPrimitivePreamble(polyhedron); 253 302 G4OpenGLSceneHandler::AddPrimitive(polyhedron); … … 260 309 // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still 261 310 // gets into the display list 311 #ifdef G4DEBUG_VIS_OGL 312 printf("G4OpenGLStoredSceneHandler::AddPrimitive nurbs\n"); 313 #endif 262 314 AddPrimitivePreamble(nurbs); 263 315 G4OpenGLSceneHandler::AddPrimitive(nurbs); … … 301 353 // Make a List which calls the other lists. 302 354 fTopPODL = glGenLists (1); 355 #ifdef G4DEBUG_VIS_OGL 356 printf("G4OpenGLStoredSceneHandler::EndModeling ->glGenList(1) fTopPODL:%d\n",fTopPODL); 357 #endif 303 358 if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate? 304 359 G4cout << … … 309 364 glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); { 310 365 for (size_t i = 0; i < fPOList.size (); i++) { 366 #ifdef G4DEBUG_VIS_OGL 367 printf("+5\n"); 368 #endif 311 369 glPushMatrix(); 312 370 G4OpenGLTransform3D oglt (fPOList[i].fTransform); … … 315 373 glLoadName(fPOList[i].fPickName); 316 374 glCallList (fPOList[i].fDisplayListId); 375 #ifdef G4DEBUG_VIS_OGL 376 printf("-4\n"); 377 #endif 317 378 glPopMatrix(); 318 379 } … … 337 398 void G4OpenGLStoredSceneHandler::ClearStore () { 338 399 400 //G4cout << "G4OpenGLStoredSceneHandler::ClearStore" << G4endl; 401 339 402 G4VSceneHandler::ClearStore (); // Sets need kernel visit, etc. 340 403 … … 355 418 fTOList.clear (); 356 419 357 fDisplayListBase = fDisplayListId;358 420 fMemoryForDisplayLists = true; 359 360 421 } 361 422 362 423 void G4OpenGLStoredSceneHandler::ClearTransientStore () { 424 425 //G4cout << "G4OpenGLStoredSceneHandler::ClearTransientStore" << G4endl; 363 426 364 427 G4VSceneHandler::ClearTransientStore (); … … 369 432 fTOList.clear (); 370 433 371 fDisplayListBase = fDisplayListId;372 434 fMemoryForDisplayLists = true; 373 435 … … 476 538 G4bool G4OpenGLStoredSceneHandler::fMemoryForDisplayLists = true; 477 539 G4int G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000; 478 G4int G4OpenGLStoredSceneHandler::fDisplayListBase = 0; 479 480 #endif 540 541 #endif -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
r1340 r1346 155 155 } 156 156 157 if (fG4OpenGLStoredSceneHandler.fTopPODL) 157 if (fG4OpenGLStoredSceneHandler.fTopPODL) { 158 158 glCallList (fG4OpenGLStoredSceneHandler.fTopPODL); 159 159 #ifdef G4DEBUG_VIS_OGL 160 printf("fTopPODL :%d\n",fG4OpenGLStoredSceneHandler.fTopPODL); 161 #endif 162 } 163 #ifdef G4DEBUG_VIS_OGL 164 printf("TOList :"); 165 #endif 160 166 for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) { 161 167 #ifdef G4DEBUG_VIS_OGL … … 180 186 bsf * c.GetBlue() + (1. - bsf) * bg.GetBlue()); 181 187 glCallList (to.fDisplayListId); 188 #ifdef G4DEBUG_VIS_OGL 189 printf("%d ",to.fDisplayListId); 190 #endif 182 191 glPopMatrix(); 183 192 } -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc
r1343 r1346 66 66 CreateGLXContext (vi_stored); 67 67 CreateMainWindow (); 68 CreateFontLists ();68 // CreateFontLists (); 69 69 70 70 InitializeGLView (); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r1340 r1346 388 388 DrawView(); 389 389 GLint hits = glRenderMode(GL_RENDER); 390 #ifdef G4DEBUG_VIS_OGL 391 printf("G4OpenGLViewer::Pick °_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_\n"); 392 #endif 390 393 if (hits < 0) 391 394 G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl; … … 619 622 620 623 624 /* Draw Gl2Ps text if needed 625 return true if it is draw 626 */ 627 bool G4OpenGLViewer::drawGl2psText(const char * textString, int size) { 628 629 if (!fGL2PSAction) return false; 630 if (fGL2PSAction->fileWritingEnabled()) { 631 gl2psText(textString,"Times-Roman",size); 632 return true; 633 } 634 return false; 635 } 636 637 621 638 bool G4OpenGLViewer::printGl2PS() { 622 639 … … 646 663 // http://www.songho.ca/opengl/gl_fbo.html 647 664 665 NeedKernelVisit (); 648 666 ResizeGLView(); 649 667 if (fGL2PSAction->enableFileWriting()) { -
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r1343 r1346 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.cc,v 1.5 5 2009/05/13 10:28:00 lgarnierExp $27 // $Id: G4OpenGLXViewer.cc,v 1.56 2010/11/10 17:57:16 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 38 38 #include "G4VViewer.hh" 39 39 #include "G4OpenGLSceneHandler.hh" 40 #include <GL/glu.h>41 40 42 41 #include "G4OpenGLFontBaseStore.hh" … … 50 49 #include "G4Normal3D.hh" 51 50 #include "G4StateManager.hh" 51 #include "G4VisManager.hh" 52 52 53 53 #include <X11/Xatom.h> … … 197 197 if (!cmap) { 198 198 fViewId = -1; // This flags an error. 199 G4cerr << 200 "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap." 201 << G4endl; 199 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 200 G4cerr << 201 "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap." 202 << G4endl; 202 203 return; 203 204 } 204 G4cout << "Got standard cmap" << G4endl; 205 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 206 G4cout << "Got standard cmap" << G4endl; 205 207 } else { 206 208 cmap = XCreateColormap (dpy, … … 208 210 vi -> visual, 209 211 AllocNone); 210 G4cout << "Created own cmap" << G4endl; 212 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 213 G4cout << "Created own cmap" << G4endl; 211 214 } 212 215 213 216 if (!cmap) { 214 217 fViewId = -1; // This flags an error. 215 G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap." 216 << G4endl; 218 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 219 G4cout << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap." 220 << G4endl; 217 221 return; 218 222 } … … 250 254 size_hints->flags |= PPosition; 251 255 } 252 G4cout << "Window name: " << fName << G4endl; 256 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 257 G4cout << "Window name: " << fName << G4endl; 253 258 strncpy (charViewName, fName, 100); 254 259 char *window_name = charViewName; … … 337 342 } 338 343 344 void G4OpenGLXViewer::drawText(const char * textString,int x,int y,int z, int size){ 345 346 CreateFontLists (); 347 // gl2ps or GL window ? 348 if (! drawGl2psText(textString,size)) { 349 350 G4int font_base = G4OpenGLFontBaseStore::GetFontBase(this,size); 351 if (font_base < 0) { 352 static G4int callCount = 0; 353 ++callCount; 354 if (callCount <= 10 || callCount%100 == 0) { 355 G4cout << 356 "G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count " 357 << callCount << 358 "\n No fonts available." 359 "\n Called with text \"" 360 << textString 361 << "\"\n at " 362 << "x:"<< x 363 << "y:"<< y 364 << "z:"<< z 365 << ", size " << size 366 // << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset () 367 << G4endl; 368 } 369 return; 370 } 371 // No action on offset or layout at present. 372 glPushAttrib(GL_LIST_BIT); 373 glListBase(font_base); 374 glCallLists(strlen(textString), GL_UNSIGNED_BYTE, (GLubyte *)textString); 375 glPopAttrib(); 376 } 377 } 378 379 339 380 G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene): 340 381 G4VViewer (scene, -1),
Note:
See TracChangeset
for help on using the changeset viewer.
