G4OpenGLImmediateWin32Viewer.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
00031 //                                G4OpenGLImmediateViewer.
00032 
00033 #ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
00034 
00035 #include "G4OpenGLImmediateWin32Viewer.hh"
00036 #include "G4OpenGLImmediateSceneHandler.hh"
00037 
00038 #include "G4ios.hh"
00039 
00040 G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer
00041 (G4OpenGLImmediateSceneHandler& sceneHandler,
00042  const G4String&  name):
00043 G4OpenGLViewer (sceneHandler),
00044 G4OpenGLWin32Viewer (sceneHandler),
00045 G4OpenGLImmediateViewer (sceneHandler),
00046 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
00047 
00048   if (fViewId < 0) return;  // In case error in base class instantiation.
00049 }
00050 
00051 void G4OpenGLImmediateWin32Viewer::Initialise () {
00052 
00053 // ensure a suitable window was found
00054 
00055   CreateGLWin32Context ();
00056   CreateMainWindow ();
00057   CreateFontLists ();
00058 
00059   // If a double buffer context has been forced upon us, ignore the
00060   // back buffer for this OpenGLImmediate view.
00061   glDrawBuffer (GL_FRONT);
00062 
00063   // clear the buffers and window.
00064   ClearView ();
00065   FinishView ();
00066 
00067   glDepthFunc (GL_LEQUAL);
00068   glDepthMask (GL_TRUE);
00069 }
00070 
00071 void G4OpenGLImmediateWin32Viewer::DrawView () {
00072 
00073   // If a double buffer context has been forced upon us, ignore the
00074   // back buffer for this OpenGLImmediate view.
00075   glDrawBuffer (GL_FRONT);
00076 
00077   G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
00078 
00079   //Make sure current viewer is attached and clean...
00080   //Win32 version needed
00081   //glXMakeCurrent (dpy, win, cx);
00082   glViewport (0, 0, getWinWidth(), getWinHeight());
00083 
00084   if(style!=G4ViewParameters::hlr &&
00085      haloing_enabled) {
00086 
00087     HaloingFirstPass ();
00088     NeedKernelVisit ();
00089     ProcessView ();
00090     glFlush ();
00091 
00092     HaloingSecondPass ();
00093 
00094   }
00095 
00096   NeedKernelVisit ();  // Always need to visit G4 kernel.
00097   ProcessView ();
00098   FinishView ();
00099 
00100 }
00101 
00103 void G4OpenGLImmediateWin32Viewer::FinishView (
00104 ) 
00105 
00106 
00107 {
00108   if(!fHDC) return;
00109 
00110   glFlush ();
00111 
00112   // Empty the Windows message queue :
00113   MSG event;
00114   while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
00115     ::TranslateMessage(&event);
00116     ::DispatchMessage (&event);
00117   }
00118 }
00119 
00120 #endif

Generated on Mon May 27 17:49:09 2013 for Geant4 by  doxygen 1.4.7