// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id: G4OpenGLImmediateQtViewer.cc,v 1.16 2007/06/25 16:38:13 $ // GEANT4 tag $Name: geant4-08-02-patch-01 $ // // // Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and // G4OpenGLImmediateViewer. #ifdef G4VIS_BUILD_OPENGLQT_DRIVER #include "G4OpenGLImmediateQtViewer.hh" #include "G4ios.hh" G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer (G4OpenGLImmediateSceneHandler& sceneHandler, const G4String& name): G4OpenGLViewer (sceneHandler), G4OpenGLQtViewer (sceneHandler), G4OpenGLImmediateViewer (sceneHandler), G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) { if (fViewId < 0) return; // In case error in base class instantiation. } void G4OpenGLImmediateQtViewer::Initialise () { readyToPaint = false; // ensure a suitable window was found printf("G4OpenGLImmediateQtViewer::Initialise () 1\n"); CreateGLQtContext (); CreateMainWindow (this); CreateFontLists (); // If a double buffer context has been forced upon us, ignore the // back buffer for this OpenGLImmediate view. glDrawBuffer (GL_FRONT); // clear the buffers and window. ClearView (); FinishView (); glDepthFunc (GL_LEQUAL); glDepthMask (GL_TRUE); readyToPaint = true; } void G4OpenGLImmediateQtViewer::DrawView () { printf("G4OpenGLImmediateQtViewer::DrawView %d %d\n",WinSize_x, WinSize_y); // If a double buffer context has been forced upon us, ignore the // back buffer for this OpenGLImmediate view. glDrawBuffer (GL_FRONT); G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle(); //Make sure current viewer is attached and clean... //Qt version needed //glXMakeCurrent (dpy, win, cx); glViewport (0, 0, WinSize_x, WinSize_y); printf("******************* 1\n"); if(style!=G4ViewParameters::hlr && haloing_enabled) { printf("******************* 3\n"); HaloingFirstPass (); printf("******************* 4\n"); NeedKernelVisit (); printf("******************* 5\n"); ProcessView (); printf("******************* 6\n"); glFlush (); printf("******************* 7\n"); HaloingSecondPass (); printf("******************* 8\n"); } NeedKernelVisit (); // Always need to visit G4 kernel. printf("******************* 9\n"); ProcessView (); printf("******************* 10\n"); FinishView (); printf("G4OpenGLImmediateQtViewer::DrawView %d %d terminé\n",WinSize_x, WinSize_y); } ////////////////////////////////////////////////////////////////////////////// void G4OpenGLImmediateQtViewer::FinishView ( ) ////////////////////////////////////////////////////////////////////////////// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// { printf("G4OpenGLImmediateQtViewer::FinishView \n"); // if(!fHDC) return; glFlush (); // Empty the Windows message queue : // MSG event; // while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) { // ::TranslateMessage(&event); // ::DispatchMessage (&event); // } } void G4OpenGLImmediateQtViewer::resizeGL( int width ,int height) { printf("G4OpenGLImmediateQtViewer::resizeGL \n"); int side = qMin(width, height); glViewport((width - side) / 2, (height - side) / 2, side, side); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0); glMatrixMode(GL_MODELVIEW); printf("G4OpenGLImmediateQtViewer::resizeGL terminé \n"); } void G4OpenGLImmediateQtViewer::paintGL() { printf("G4OpenGLImmediateQtViewer::paintGL \n"); if (!readyToPaint) return; WinSize_x = (G4int) width(); WinSize_y = (G4int) height(); glViewport (0, 0, width(), height()); ClearView (); DrawView (); // FIXME // FinishView(); // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // glLoadIdentity(); // glTranslated(0.0, 0.0, -10.0); } #endif