Changeset 931 for trunk/source/visualization/OpenGL
- Timestamp:
- Feb 25, 2009, 4:19:05 PM (16 years ago)
- Location:
- trunk/source/visualization/OpenGL/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r917 r931 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1.3 5 2009/02/04 16:48:41lgarnier Exp $27 // $Id: G4OpenGLQtViewer.cc,v 1.36 2009/02/25 15:14:29 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // -
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r930 r931 160 160 void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line) 161 161 { 162 printf("----1"); 162 163 G4int nPoints = line.size (); 163 164 if (nPoints <= 0) return; … … 367 368 368 369 // Draw... 369 /// if (sizeType == world) { // Size specified in world coordinates. 370 // printf("G4OpenGLSceneHandler::AddCircleSquare world\n"); 371 // DrawXYPolygon (shape, size, centre, pVA); 372 373 // } else { // Size specified in screen (window) coordinates. 374 // printf("G4OpenGLSceneHandler::AddCircleSquare bitmap\n"); 375 376 glRasterPos3d(centre.x(),centre.y(),centre.z()); 377 const GLubyte* marker = 378 G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 379 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 380 glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 381 // } 370 if (sizeType == world) { // Size specified in world coordinates. 371 printf("G4OpenGLSceneHandler::AddCircleSquare world\n"); 372 DrawXYPolygon (shape, size, centre, pVA); 373 374 } else { // Size specified in screen (window) coordinates. 375 printf("G4OpenGLSceneHandler::AddCircleSquare screen bitmap size:%d\n",size); 376 377 int test=3; 378 if (test == 1) { 379 // Find window coordinates of centre... 380 GLdouble modelMatrix[16]; 381 glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); 382 G4double projectionMatrix[16]; 383 glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix); 384 GLint viewport[4]; 385 glGetIntegerv(GL_VIEWPORT,viewport); 386 GLdouble winx, winy, winz; 387 gluProject(centre.x(), centre.y(), centre.z(), 388 modelMatrix, projectionMatrix, viewport, 389 &winx, &winy, &winz); 390 391 // Determine ratio window:world... 392 const G4Vector3D& viewpointDirection = 393 fpViewer -> GetViewParameters().GetViewpointDirection(); 394 const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector(); 395 const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit(); 396 const G4Vector3D p = centre + inScreen; 397 GLdouble winDx, winDy, winDz; 398 gluProject(p.x(), p.y(), p.z(), 399 modelMatrix, projectionMatrix, viewport, 400 &winDx, &winDy, &winDz); 401 G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) + 402 std::pow(winy - winDy, 2)); 403 DrawXYPolygon (shape, size/winWorldRatio, centre, pVA); 404 405 } else if (test == 2) { 406 // glMatrixMode(GL_PROJECTION); 407 glPushMatrix(); 408 // glLoadIdentity(); 409 // gluOrtho2D(0.0,640.0,480.0,10.0); 410 411 // glDisable(GL_DEPTH_TEST); 412 glRotatef (30, 0, -1, 0); 413 glRotatef (20, -1, 0, 0); 414 glRotatef (50, 0, 0, -1); 415 DrawXYPolygon (shape, size, centre, pVA); 416 417 418 glPopMatrix(); 419 420 // glMatrixMode(GL_MODELVIEW); 421 // glEnable(GL_DEPTH_TEST); 422 } else if (test == 3){ // Avec DrawPolygone, mais en forcant 423 424 glPointSize (size); 425 glBegin (GL_POINTS); 426 glVertex3f(centre.x(),centre.y(),centre.z()); 427 glEnd(); 428 //Antialiasing sur les points 429 glEnable (GL_POINT_SMOOTH); 430 //Gestion de la transparence 431 glEnable(GL_BLEND); 432 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 433 434 // const G4Point3D targetPoint 435 // = fSceneHandler.GetScene()->GetStandardTargetPoint() 436 // + fVP.GetCurrentTargetPoint (); 437 // G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 438 // if(radius<=0.) radius = 1.; 439 // const G4double cameraDistance = fVP.GetCameraDistance (radius); 440 // const G4Point3D cameraPosition = 441 // targetPoint + cameraDistance * fVP.GetViewpointDirection().unit(); 442 } else { 443 glRasterPos3d(centre.x(),centre.y(),centre.z()); 444 const GLubyte* marker = 445 G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 446 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 447 glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 448 } 449 } 382 450 } 383 451 -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r929 r931 220 220 { 221 221 #ifdef G4DEBUG_VIS_OGL 222 printf("G4OpenGLStoredQtViewer::paintGL ??\n");222 printf("G4OpenGLStoredQtViewer::paintGL ready %d hasTorepaint:%d\n",readyToPaint,hasToRepaint); 223 223 #endif 224 224 if (!readyToPaint) { -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r929 r931 33 33 34 34 #ifdef G4VIS_BUILD_OPENGL_DRIVER 35 36 #define G4DEBUG_VIS_OGL 35 37 36 38 #include "G4ios.hh" … … 143 145 144 146 void G4OpenGLViewer::ClearView () { 147 #ifdef G4DEBUG_VIS_OGL 148 printf("G4OpenGLViewer::ClearView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV \n"); 149 #endif 145 150 glClearColor (background.GetRed(), 146 151 background.GetGreen(), … … 154 159 glClear (GL_STENCIL_BUFFER_BIT); 155 160 glFlush (); 161 #ifdef G4DEBUG_VIS_OGL 162 printf("G4OpenGLViewer::ClearView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); 163 #endif 156 164 } 157 165 … … 169 177 170 178 void G4OpenGLViewer::SetView () { 179 180 #ifdef G4DEBUG_VIS_OGL 181 printf("G4OpenGLViewer::SetView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV \n"); 182 #endif 171 183 172 184 if (!fSceneHandler.GetScene()) { … … 308 320 background = fVP.GetBackgroundColour (); 309 321 322 #ifdef G4DEBUG_VIS_OGL 323 printf("G4OpenGLViewer::SetView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n"); 324 #endif 310 325 } 311 326 312 327 void G4OpenGLViewer::HaloingFirstPass () { 313 328 329 #ifdef G4DEBUG_VIS_OGL 330 printf("G4OpenGLViewer::HaloingFirstPass VVVVVVVVVVVVVVVVVV \n"); 331 #endif 314 332 //To perform haloing, first Draw all information to the depth buffer 315 333 //alone, using a chunky line width, and then Draw all info again, to … … 334 352 void G4OpenGLViewer::HaloingSecondPass () { 335 353 354 #ifdef G4DEBUG_VIS_OGL 355 printf("G4OpenGLViewer::HaloingSecondtPass VVVVVVVVVVVVVVVVVV \n"); 356 #endif 336 357 //And finally, turn the colour buffer back on with a sesible line width... 337 358 glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); … … 888 909 889 910 // FIXME : TEST 890 G4VMarker defaultMarker = GetViewParameters().GetDefaultMarker(); 891 defaultMarker.SetWorldSize(defaultMarker.GetScreenSize()); 892 defaultMarker.SetWorldDiameter(defaultMarker.GetScreenDiameter()); 893 defaultMarker.SetWorldRadius(defaultMarker.GetScreenRadius()); 911 printf("G4OpenGLViewer::WritePostScript world size:%f\n",GetViewParameters().GetDefaultMarker().GetWorldSize()); 912 G4ViewParameters vp = GetViewParameters(); 913 G4VMarker defaultMarker = vp.GetDefaultMarker(); 914 G4VMarker myMarker = vp.GetDefaultMarker(); 915 916 myMarker.SetScreenSize(0); // before SetWorldSize 917 myMarker.SetScreenDiameter(0); // before SetWorldSize 918 myMarker.SetScreenRadius(0); // before SetWorldSize 919 920 myMarker.SetWorldSize(6.); 921 myMarker.SetWorldDiameter(4.); 922 myMarker.SetWorldRadius(3.); 923 // myMarker.SetWorldSize(defaultMarker.GetScreenSize()); 924 // myMarker.SetWorldDiameter(defaultMarker.GetScreenDiameter()); 925 // myMarker.SetWorldRadius(defaultMarker.GetScreenRadius()); 926 927 vp.SetDefaultMarker(myMarker); 928 SetViewParameters(vp); 894 929 895 930 fGL2PSAction->setFileName("PostScriptViaGL2PS.ps"); 896 931 if (fGL2PSAction->enableFileWriting()) { 897 ShowView();932 NeedKernelVisit (); 898 933 ProcessView(); 899 DrawView(); 934 SetView (); 935 ClearView (); 936 DrawView (); 900 937 fGL2PSAction->disableFileWriting(); 901 938 } 902 // defaultMarker.SetScreenSize(defaultMarker.GetWorldSize()); 903 // defaultMarker.SetScreenDiameter(defaultMarker.GetWorldDiameter()); 904 // defaultMarker.SetScreenRadius(defaultMarker.GetWorldRadius()); 939 vp.SetDefaultMarker(defaultMarker); 940 SetViewParameters(vp); 905 941 // FIXME : TEST 906 942 -
trunk/source/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r916 r931 25 25 // 26 26 // 27 // $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1. 8 2009/01/19 16:26:40 lgarnier Exp $27 // $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.9 2009/02/25 15:15:50 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 //
Note: See TracChangeset
for help on using the changeset viewer.