Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 87164 2014-11-26 08:48:31Z gcosmo $
|
||||
$Id: History 94428 2015-11-16 12:40:02Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,109 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
5th November 2015 Laurent Garnier (opengl-V10-01-13)
|
||||
- G4OpenGLViewer: Fix warning with VC14
|
||||
|
||||
5th November 2015 Laurent Garnier (opengl-V10-01-12)
|
||||
- Fix the "SetVisible" problem on
|
||||
* Linux/Windows
|
||||
* Mac with Qt4 (or with Qt5)
|
||||
but introduce another minor problem: when opening a new viewer, we have to update it by clic
|
||||
into viewer, or issue "/vis/viewer/refresh"
|
||||
|
||||
2nd November 2015 Laurent Garnier
|
||||
- G4OpenGLViewer.cc: Fix a small problem in picking list
|
||||
|
||||
21st September 2015 John Allison (opengl-V10-01-11)
|
||||
- G4OpenGLXViewer.cc: Uses <chrono> for picking. (Another attempt.)
|
||||
|
||||
5th August 2015 John Allison (opengl-V10-01-10)
|
||||
- Reverted to G4THREADSLEEP for picking.
|
||||
|
||||
1st August 2015 John Allison (opengl-V10-01-09)
|
||||
- G4OpenGLXViewer.cc:
|
||||
o Uses <chrono> for picking.
|
||||
|
||||
30th July 2015 John Allison (opengl-V10-01-08)
|
||||
- Improved graphics system fallback strategy:
|
||||
o Implemented IsUISessionCompatible in G4OpenGLQt and G4OpenGLXm.
|
||||
o Qt not allowed unless a Qt session has been instantiated.
|
||||
o Interactive graphics systems (Qt, Xm) are not allowed in batch.
|
||||
- G4OpenGLStoredQtSceneHandler.cc: Removed unused variable.
|
||||
|
||||
29th July 2015 Laurent Garnier
|
||||
- Fix a minor problem for Qt driver: open/close icons on scene tree/viewer properties and pick were not good at start
|
||||
- Minor improvements on the interface on scene tree/viewer properties and pick item menu
|
||||
|
||||
28th July 2015 Laurent Garnier
|
||||
- Fix a bug when launching OGL driver from a macro file (in batch mode). Crash solved,
|
||||
but an exception is still sent
|
||||
|
||||
24th July 2015 Laurent Garnier
|
||||
- Clean debug statements
|
||||
- FIX DEV-86: extra ".eps" at the end of filename
|
||||
|
||||
26th June 2015 John Allison (opengl-V10-01-07)
|
||||
- G4OpenGLStoredViewer: Coverity fix (uninitialised data member).
|
||||
- G4OpenGLViewer.cc: Fixed bug found by Coverity (=! instead of !=).
|
||||
|
||||
3rd June 2015 John Allison (opengl-V10-01-06 co-works with visman-V10-01-10)
|
||||
- Needs global-V10-01-13 for G4OpenGLXViewer.cc.
|
||||
- Migrated to new G4VViewer interface - see visman-V10-01-10.
|
||||
- G4OpenGLXViewer.cc: Re-introduced sleep while waiting for pick action.
|
||||
|
||||
27th May 2015 Laurent Garnier (opengl-V10-01-05 co-works with visman-V10-01-09)
|
||||
- A bit of cleaning in managing OpenGL context (Qt)
|
||||
|
||||
26th May 2015 John Allison
|
||||
- G4OpenGLXViewer.cc: Removed sleep in pick action for now. Wait for globals.
|
||||
|
||||
26th May 2015 John Allison
|
||||
- G4OpenGLXViewer.cc: Added sleep while waiting for pick action.
|
||||
|
||||
26th May 2015 Laurent Garnier
|
||||
- Add methods to manage QtGLContext (not finished yet!)
|
||||
|
||||
19th December 2014 John Allison (opengl-V10-01-04)
|
||||
- Removed debug printing (MT mode).
|
||||
|
||||
16th December 2014 John Allison (opengl-V10-01-03)
|
||||
- G4OpenGLQtViewer.cc: Fixed compiler warning.
|
||||
- Merged vis sub-thread developments.
|
||||
|
||||
15th December 2014 Laurent Garnier (opengl-V10-01-02)
|
||||
- G4OpenGLViewer.cc
|
||||
o replace "far" and "near" by "zFar" and "zNear" to avoid windows errors
|
||||
|
||||
15th December 2014 Laurent Garnier (opengl-V10-01-01)
|
||||
- Same tag as opengl-V10-01-00. Try to understand why on a window machine :
|
||||
"G4OpenGLViewer.cc(1445): error C2059: syntax error : ')' [D:\build\"
|
||||
|
||||
15th December 2014 Laurent Garnier (opengl-V10-01-00)
|
||||
- G4OpenGLViewer,
|
||||
G4OpenGLImmediateSceneHandler,
|
||||
G4OpenGLStoredSceneHandler,
|
||||
G4OpenGLStoredViewer,
|
||||
G4OpenGLViewer.cc :
|
||||
Fix a problem when zooming on small volumes. The glOrtho function has some problems with
|
||||
small values. Calculate all by hand and call glMatrix seems to solve this.
|
||||
|
||||
2nd December 2014 John Allison (vis-MT-branch-00-opengl-12)
|
||||
- G4OpenGLStoredQtViewer::DrawView(): Removed thread restriction.
|
||||
- G4OpenGLQtViewer.cc:
|
||||
o Messy experimental version - needs cleaning. I think this
|
||||
is not be necessary but leave it for now.
|
||||
namespace {
|
||||
const QGLContext* masterContext = 0;
|
||||
const QGLContext* visSubThreadContext = 0;
|
||||
}
|
||||
|
||||
30th November 2014 John Allison (vis-MT-branch-00-opengl-11)
|
||||
- Introduced DoneWithMaster/VisSubThread.
|
||||
|
||||
26th November 2014 John Allison (vis-MT-branch-00-opengl-10)
|
||||
- Merged opengl-V10-00-28 into MT version.
|
||||
|
||||
25th November 2014 Laurent Garnier (opengl-V10-00-28)
|
||||
- G4OpenGLStoredQtViewer/G4OpenGLImmediatedQtViewer :
|
||||
Fix refresh problem due to a bad threading management
|
||||
@@ -28,6 +131,9 @@ committal in the CVS repository !
|
||||
o Fixes a bug whereby hidden markers are not respected if 2D objects
|
||||
are drawn.
|
||||
|
||||
22nd November 2014 John Allison (vis-MT-branch-00-opengl-09)
|
||||
- Merged opengl-V10-00-27 into MT version.
|
||||
|
||||
21st November 2014 Laurent Garnier (opengl-V10-00-27)
|
||||
- G4OpenGLStoredQtViewer/G4OpenGLImmediatedQtViewer :
|
||||
o Avoid repainting problems by disable recursive repaints (from last commit)
|
||||
@@ -47,6 +153,19 @@ committal in the CVS repository !
|
||||
18th November 2014 Laurent Garnier (opengl-V10-00-24)
|
||||
- G4OpenGLQtViewer: Fix JIRA DEV-173 about using external application
|
||||
|
||||
8th November 2014 John Allison (vis-MT-branch-00-opengl-08)
|
||||
- Merged trunk again. (Just History.)
|
||||
|
||||
7th November 2014 John Allison (vis-MT-branch-00-opengl-07)
|
||||
- Merged trunk again. (Some developments by Laurent.)
|
||||
|
||||
7th November 2014 John Allison (vis-MT-branch-00-opengl-06)
|
||||
- Merged trunk again. (Some developments by Laurent.)
|
||||
|
||||
7th November 2014 John Allison (vis-MT-branch-00-opengl-05)
|
||||
- Merged the trunk into this branch, except:
|
||||
o Re-introduced updateQWidget() in G4OpenGLStoredQtViewer::ClearView.
|
||||
|
||||
7th November 2014 Laurent Garnier (opengl-V10-00-22 - opengl-V10-00-23)
|
||||
- G4OpenGLQtViewer:
|
||||
o Fix the "invalid drawable" warning in Qt
|
||||
@@ -80,6 +199,29 @@ committal in the CVS repository !
|
||||
G4OpenGLWtViewer
|
||||
o Fix a problem with Wt include names on case sensitive systems
|
||||
|
||||
7th November 2014 John Allison
|
||||
- G4OpenGLQtViewer.cc: Fixed compiler warning.
|
||||
|
||||
6th November 2014 John Allison (vis-MT-branch-00-opengl-03)
|
||||
- G4OpenGLQtViewer.cc:
|
||||
o Fixed missing return value.
|
||||
o Added a comment for possible future attention.
|
||||
- G4OpenGLXmWindowHandlingCallbacks.cc:
|
||||
o Added a comment for possible future attention.
|
||||
|
||||
5th November 2014 Laurent Garnier
|
||||
- G4OpenGLQtViewer:
|
||||
o Rename fWindow by fGLWidget and avoid problems for users using an external
|
||||
Qt Application (and external Main Window)
|
||||
o Remove resizing GLwidget *before* it was attached in the ui. This will prevent
|
||||
from a early repainting
|
||||
|
||||
1st November 2014 John Allison (vis-MT-branch-00-opengl-02)
|
||||
- Fixed mistake in merging.
|
||||
|
||||
1st November 2014 John Allison (vis-MT-branch-00-opengl-01)
|
||||
- Merged vis-V10-00-11 and tagged.
|
||||
|
||||
5th November 2014 Laurent Garnier
|
||||
- G4OpenGLQtViewer:
|
||||
o Rename fWindow by fGLWidget and avoid problems for users using an external
|
||||
@@ -102,6 +244,38 @@ G4OpenGLImmediateSceneHandler, G4OpenGLSceneHandler :
|
||||
G4OpenGLQtViewer:
|
||||
o Suppress sizeX, sizeY when calling AddTabWidget (needs interfaces-V10-00-15)
|
||||
|
||||
31th October 2014 Laurent Garnier
|
||||
o Fix a problem with Wt include names on case sensitive systems
|
||||
|
||||
29th October 2014 Laurent Garnier
|
||||
- G4OpenGLViewer :
|
||||
o Add a ClearView without flush function
|
||||
- G4OpenGLStoreQtViewer :
|
||||
o Add a lock to prevent recursive updates
|
||||
o Implements ClearView in order to force a redraw (updateGL())
|
||||
|
||||
28th October 2014 Laurent Garnier
|
||||
- G4OpenGLStoredQtViewer/G4OpenGLImmediateQtViewer : Prevent from calling redrawing
|
||||
scene inside a Vis Thread
|
||||
|
||||
27th October 2014 Laurent Garnier
|
||||
- G4OpenGLStoredViewer
|
||||
o Solve DEV-170 bug, introduced 4th september
|
||||
- G4OpenGLQtViewer
|
||||
o Add SwitchToVisSubThread() and SwitchToMasterThread() functions
|
||||
|
||||
22nd October 2014 John Allison (vis-MT-branch-00-opengl-00)
|
||||
- Sub-thread developments.
|
||||
|
||||
24th October 2014 Laurent Garnier (opengl-V10-00-20 require interfaces-V10-00-15)
|
||||
G4OpenGLImmediateSceneHandler, G4OpenGLSceneHandler :
|
||||
o Improvements for OpenGL VBO
|
||||
G4OpenGLQtViewer:
|
||||
o Suppress sizeX, sizeY when calling AddTabWidget (needs interfaces-V10-00-15)
|
||||
|
||||
22nd October 2014 John Allison (vis-MT-branch-00-opengl-00)
|
||||
- Sub-thread developments.
|
||||
|
||||
22nd October 2014 John Allison (opengl-V10-00-19)
|
||||
- Tagged.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXm.hh 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateXm.hh 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -33,9 +33,9 @@
|
||||
#ifndef G4OPENGLIMMEDIATEXM_HH
|
||||
#define G4OPENGLIMMEDIATEXM_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "G4OpenGLXm.hh"
|
||||
|
||||
class G4OpenGLImmediateXm: public G4VGraphicsSystem {
|
||||
class G4OpenGLImmediateXm: public G4OpenGLXm {
|
||||
public:
|
||||
G4OpenGLImmediateXm ();
|
||||
virtual ~G4OpenGLImmediateXm ();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLQtViewer.hh 86360 2014-11-10 08:34:16Z gcosmo $
|
||||
// $Id: G4OpenGLQtViewer.hh 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// G4OpenGLQtViewer : Class to provide WindowsNT specific
|
||||
@@ -91,8 +91,19 @@ public:
|
||||
G4OpenGLQtViewer (G4OpenGLSceneHandler& scene);
|
||||
virtual ~G4OpenGLQtViewer ();
|
||||
#ifdef G4MULTITHREADED
|
||||
void SwitchToVisSubThread();
|
||||
void SwitchToMasterThread();
|
||||
// In MT mode these functions are called in the following order for each run:
|
||||
// Called on the master thread before starting the vis sub-thread.
|
||||
virtual void DoneWithMasterThread ();
|
||||
// Called on the master thread after starting the vis sub-thread.
|
||||
virtual void MovingToVisSubThread ();
|
||||
// Called on the vis sub-thread when waiting for events.
|
||||
virtual void SwitchToVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
virtual void DoneWithVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
// virtual void MovingToMasterThread (); Not used in G4OpenGLQtViewer.
|
||||
// Called on the master thread after the vis sub-thread has terminated.
|
||||
virtual void SwitchToMasterThread ();
|
||||
#endif
|
||||
|
||||
private:
|
||||
@@ -201,9 +212,9 @@ private:
|
||||
unsigned int currentIndex,
|
||||
int currentPVPOIndex);
|
||||
void setCheckComponent(QTreeWidgetItem* item,bool check);
|
||||
void initSceneTreeComponent();
|
||||
void initViewerPropertiesComponent();
|
||||
void initPickingComponent();
|
||||
void createSceneTreeComponent();
|
||||
void createViewerPropertiesComponent();
|
||||
void createPickingComponent();
|
||||
bool parseAndCheckVisibility(QTreeWidgetItem * treeNode,int POindex);
|
||||
QTreeWidgetItem* createTreeWidgetItem(const PVPath& fullPath,
|
||||
const QString& name,
|
||||
@@ -239,6 +250,15 @@ private:
|
||||
QString GetCommandParameterList (const G4UIcommand *aCommand);
|
||||
void changeColorAndTransparency(GLuint index, G4Color color);
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
inline void SetQGLContextVisSubThread(QThread *th) {
|
||||
fQGLContextVisSubThread = th;
|
||||
}
|
||||
inline void SetQGLContextMainThread(QThread *th) {
|
||||
fQGLContextMainThread = th;
|
||||
}
|
||||
#endif
|
||||
|
||||
QMenu *fContextMenu;
|
||||
QPoint fLastPos1;
|
||||
QPoint fLastPos2;
|
||||
@@ -348,6 +368,11 @@ private:
|
||||
GLuint fLastHighlightName;
|
||||
bool fIsDeleting;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
QThread* fQGLContextVisSubThread;
|
||||
QThread* fQGLContextMainThread;
|
||||
#endif
|
||||
|
||||
public Q_SLOTS :
|
||||
void startPauseVideo();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredViewer.hh 85263 2014-10-27 08:58:31Z gcosmo $
|
||||
// $Id: G4OpenGLStoredViewer.hh 91268 2015-06-29 07:04:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
virtual G4bool POSelected(size_t) {return true;}
|
||||
virtual G4bool TOSelected(size_t) {return true;}
|
||||
|
||||
bool fDepthTestEnable;
|
||||
G4bool fDepthTestEnable;
|
||||
G4Colour fOldDisplayListColor;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXm.hh 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLStoredXm.hh 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -33,9 +33,9 @@
|
||||
#ifndef G4OPENGLSTOREDXM_HH
|
||||
#define G4OPENGLSTOREDXM_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "G4OpenGLXm.hh"
|
||||
|
||||
class G4OpenGLStoredXm: public G4VGraphicsSystem {
|
||||
class G4OpenGLStoredXm: public G4OpenGLXm {
|
||||
public:
|
||||
G4OpenGLStoredXm ();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
#ifdef G4OPENGL_VERSION_2
|
||||
|
||||
#define G4DEBUG_VIS_OGL 1
|
||||
|
||||
// GL2PS
|
||||
#define GL2PS_TEXT_B 4
|
||||
#define GL2PS_TEXT_BL 5
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewer.hh 86360 2014-11-10 08:34:16Z gcosmo $
|
||||
// $Id: G4OpenGLViewer.hh 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -189,6 +189,14 @@ protected:
|
||||
centerz,
|
||||
GLdouble upx, GLdouble upy, GLdouble upz );
|
||||
// MESA implementation of gluLookAt
|
||||
void g4GlOrtho (GLdouble left, GLdouble right,
|
||||
GLdouble bottom, GLdouble top,
|
||||
GLdouble near, GLdouble far);
|
||||
// Redefinition on glOrtho to solve precision issues
|
||||
void g4GlFrustum (GLdouble left, GLdouble right,
|
||||
GLdouble bottom, GLdouble top,
|
||||
GLdouble near, GLdouble far);
|
||||
// Redefinition on glFrustum to solve precision issues
|
||||
|
||||
G4bool fPrintColour;
|
||||
G4bool fVectoredPs;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.hh 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLXViewer.hh 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -57,6 +57,10 @@ public:
|
||||
virtual ~G4OpenGLXViewer ();
|
||||
void SetView ();
|
||||
void ShowView ();
|
||||
#ifdef G4MULTITHREADED
|
||||
void SwitchToVisSubThread();
|
||||
void SwitchToMasterThread();
|
||||
#endif
|
||||
void DrawText(const G4Text&);
|
||||
|
||||
protected:
|
||||
@@ -80,7 +84,10 @@ protected:
|
||||
Colormap cmap;
|
||||
XSetWindowAttributes swa;
|
||||
GLXDrawable win;
|
||||
GLXContext cx;
|
||||
GLXContext cxMaster;
|
||||
#ifdef G4MULTITHREADED
|
||||
GLXContext cxVisSubThread;
|
||||
#endif
|
||||
XEvent event;
|
||||
G4int *attributeList,
|
||||
errorBase,
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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:$
|
||||
//
|
||||
// John Allison 16th July 2015
|
||||
// Base class for OpenGLImmediate/StoredXm graphics system factories.
|
||||
|
||||
#ifndef G4OPENGLXM_HH
|
||||
#define G4OPENGLXM_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4OpenGLXm: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4OpenGLXm (const G4String& name,
|
||||
const G4String& nickname,
|
||||
const G4String& description,
|
||||
Functionality f);
|
||||
G4bool IsUISessionCompatible () const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 85263 2014-10-27 08:58:31Z gcosmo $
|
||||
# $Id: sources.cmake 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -127,6 +127,7 @@ if(GEANT4_USE_XM)
|
||||
G4OpenGLImmediateXmViewer.hh
|
||||
G4OpenGLStoredXm.hh
|
||||
G4OpenGLStoredXmViewer.hh
|
||||
G4OpenGLXm.hh
|
||||
G4OpenGLXmBox.hh
|
||||
G4OpenGLXmFourArrowButtons.hh
|
||||
G4OpenGLXmFramedBox.hh
|
||||
@@ -150,6 +151,7 @@ if(GEANT4_USE_XM)
|
||||
G4OpenGLImmediateXmViewer.cc
|
||||
G4OpenGLStoredXm.cc
|
||||
G4OpenGLStoredXmViewer.cc
|
||||
G4OpenGLXm.cc
|
||||
G4OpenGLXmBox.cc
|
||||
G4OpenGLXmConvenienceRoutines.cc
|
||||
G4OpenGLXmFourArrowButtons.cc
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateQt.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateQt.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// OpenGLImmediateQt graphics system factory.
|
||||
@@ -57,9 +57,6 @@ G4VSceneHandler* G4OpenGLImmediateQt::CreateSceneHandler
|
||||
|
||||
G4VViewer* G4OpenGLImmediateQt::CreateViewer
|
||||
(G4VSceneHandler& scene, const G4String& name) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQt::CreateViewer \n");
|
||||
#endif
|
||||
G4VViewer* pView = 0;
|
||||
pView = new G4OpenGLImmediateQtViewer
|
||||
((G4OpenGLImmediateSceneHandler&) scene, name);
|
||||
@@ -77,9 +74,6 @@ G4VViewer* G4OpenGLImmediateQt::CreateViewer
|
||||
G4cerr << "G4OpenGLImmediateQt::CreateViewer: null pointer on"
|
||||
" new G4OpenGLImmediateQtViewer." << G4endl;
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQt::CreateViewer END \n");
|
||||
#endif
|
||||
return pView;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateQtViewer.cc 87164 2014-11-26 08:48:31Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateQtViewer.cc 94206 2015-11-09 08:11:59Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
|
||||
@@ -76,9 +76,6 @@ G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::Initialise() {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::Initialise \n");
|
||||
#endif
|
||||
fQGLWidgetInitialiseCompleted = false;
|
||||
CreateMainWindow (this,QString(GetName()));
|
||||
CreateFontLists ();
|
||||
@@ -141,7 +138,7 @@ void G4OpenGLImmediateQtViewer::initializeGL () {
|
||||
setVisible(true) ;
|
||||
|
||||
// and update it immediatly before wait for SessionStart() (batch mode)
|
||||
QCoreApplication::sendPostedEvents () ;
|
||||
// QCoreApplication::sendPostedEvents () ;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,9 +155,6 @@ void G4OpenGLImmediateQtViewer::DrawView() {
|
||||
|
||||
void G4OpenGLImmediateQtViewer::ComputeView () {
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
|
||||
#endif
|
||||
makeCurrent();
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
@@ -175,9 +169,6 @@ void G4OpenGLImmediateQtViewer::ComputeView () {
|
||||
NeedKernelVisit ();
|
||||
ProcessView ();
|
||||
FinishView();
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
|
||||
#endif
|
||||
HaloingSecondPass ();
|
||||
|
||||
}
|
||||
@@ -189,9 +180,6 @@ void G4OpenGLImmediateQtViewer::ComputeView () {
|
||||
savePPMToTemp();
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
|
||||
#endif
|
||||
fHasToRepaint = true;
|
||||
}
|
||||
|
||||
@@ -246,9 +234,6 @@ void G4OpenGLImmediateQtViewer::paintGL()
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
|
||||
#endif
|
||||
|
||||
SetView();
|
||||
|
||||
@@ -257,9 +242,6 @@ void G4OpenGLImmediateQtViewer::paintGL()
|
||||
|
||||
fHasToRepaint = false; // could be set to false by ComputeView
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",fReadyToPaint);
|
||||
#endif
|
||||
fPaintEventLock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc 85263 2014-10-27 08:58:31Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -248,9 +248,10 @@ void G4OpenGLImmediateSceneHandler::BeginPrimitives2D
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
#ifndef G4OPENGL_VERSION_2
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
#endif
|
||||
G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
|
||||
if (pViewer) {
|
||||
pViewer->g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
}
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateXViewer.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "G4OpenGLImmediateSceneHandler.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
G4OpenGLImmediateXViewer::
|
||||
G4OpenGLImmediateXViewer (G4OpenGLImmediateSceneHandler& sceneHandler,
|
||||
@@ -79,9 +80,18 @@ void G4OpenGLImmediateXViewer::DrawView () {
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
glXMakeCurrent (dpy, win, cx);
|
||||
|
||||
// //Make sure current viewer is attached and clean...
|
||||
//#ifdef G4MULTITHREADED
|
||||
// G4int thread_id = G4Threading::G4GetThreadId();
|
||||
// G4cout << "G4OpenGLImmediateXViewer::DrawView: thread " << thread_id << G4endl;
|
||||
// if (thread_id < 0) {
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
// } else {
|
||||
// glXMakeCurrent (dpy, win, cxVisSubThread);
|
||||
// }
|
||||
//#else
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
//#endif
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXm.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateXm.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -43,10 +43,10 @@
|
||||
#include "G4OpenGLImmediateSceneHandler.hh"
|
||||
|
||||
G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
|
||||
G4VGraphicsSystem ("OpenGLImmediateXm",
|
||||
"OGLIXm",
|
||||
G4VisFeaturesOfOpenGLIXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
G4OpenGLXm ("OpenGLImmediateXm",
|
||||
"OGLIXm",
|
||||
G4VisFeaturesOfOpenGLIXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXmViewerMessenger::GetInstance();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXmViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLImmediateXmViewer.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "G4OpenGLImmediateSceneHandler.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
G4OpenGLImmediateXmViewer::
|
||||
G4OpenGLImmediateXmViewer(G4OpenGLImmediateSceneHandler& sceneHandler,
|
||||
@@ -80,8 +81,18 @@ void G4OpenGLImmediateXmViewer::DrawView () {
|
||||
printf("G4OpenGLImmediateXmViewer::DrawView : \n");
|
||||
#endif
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
glXMakeCurrent (dpy, win, cx);
|
||||
// //Make sure current viewer is attached and clean...
|
||||
//#ifdef G4MULTITHREADED
|
||||
// G4int thread_id = G4Threading::G4GetThreadId();
|
||||
// G4cout << "G4OpenGLImmediateXmViewer::DrawView: thread " << thread_id << G4endl;
|
||||
// if (thread_id < 0) {
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
// } else {
|
||||
// glXMakeCurrent (dpy, win, cxVisSubThread);
|
||||
// }
|
||||
//#else
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
//#endif
|
||||
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
|
||||
@@ -52,25 +52,24 @@ G4bool G4OpenGLQt::IsUISessionCompatible () const
|
||||
G4bool isCompatible = false;
|
||||
G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetSession();
|
||||
// In case it's a G4UIbatch, find original session by recursive search until
|
||||
// the session is no longer a G4UIbatch, in which case it will be the
|
||||
// original session, if any.
|
||||
|
||||
// If session is a batch session, it may be:
|
||||
// a) this is a batch job (the user has not instantiated any UI session);
|
||||
// b) we are currently processing a UI command, in which case the UI
|
||||
// manager creates a temporary batch session and to find out if there is
|
||||
// a genuine UI session that the user has instantiated we must drill
|
||||
// down through previous sessions to a possible non-batch session.
|
||||
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
session = batch->GetPreviousSession();
|
||||
}
|
||||
if (!session) {
|
||||
// The user has not instantiated a session - must be batch.
|
||||
// It's OK to have a Qt window in batch - you can open a viewer, create a
|
||||
// scene, set view parameters and /vis/ogl/printEPS.
|
||||
isCompatible = true;
|
||||
} else {
|
||||
// The user has instantiated a session...
|
||||
|
||||
// Qt windows are only appropriate in a Qt session.
|
||||
if (session) {
|
||||
// If non-zero, this is the originating non-batch session
|
||||
// The user has instantiated a UI session...
|
||||
if (dynamic_cast<G4UIQt*>(session)) {
|
||||
// ...and it's a G4UIQt session, which is OK.
|
||||
isCompatible = true;
|
||||
} else {
|
||||
// Not OK - go and find the fallback graphics system.
|
||||
isCompatible = false;
|
||||
}
|
||||
}
|
||||
return isCompatible;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLQtViewer.cc 87164 2014-11-26 08:48:31Z gcosmo $
|
||||
// $Id: G4OpenGLQtViewer.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// G4OpenGLQtViewer : Class to provide Qt specific
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "G4Text.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4OpenGLStoredQtViewer.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#include <CLHEP/Units/SystemOfUnits.h>
|
||||
|
||||
@@ -91,6 +92,21 @@
|
||||
#include <qsplitter.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcursor.h>
|
||||
#include <qthread.h>
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4Threading.hh"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
G4Mutex mWaitForVisSubThreadQtOpenGLContextMoved = G4MUTEX_INITIALIZER;
|
||||
G4Mutex mWaitForVisSubThreadQtOpenGLContextInitialized = G4MUTEX_INITIALIZER;
|
||||
G4Condition c1_VisSubThreadQtOpenGLContextInitialized = G4CONDITION_INITIALIZER;
|
||||
G4Condition c2_VisSubThreadQtOpenGLContextMoved = G4CONDITION_INITIALIZER;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGLQtViewer::CreateMainWindow (
|
||||
@@ -158,29 +174,19 @@ void G4OpenGLQtViewer::CreateMainWindow (
|
||||
|
||||
// not available for Immediate mode
|
||||
if (dynamic_cast<G4OpenGLStoredQtViewer*> (this)) {
|
||||
initSceneTreeComponent();
|
||||
toggleSceneTreeViewerInfos();
|
||||
createSceneTreeComponent();
|
||||
}
|
||||
|
||||
initViewerPropertiesComponent();
|
||||
initPickingComponent();
|
||||
createViewerPropertiesComponent();
|
||||
createPickingComponent();
|
||||
|
||||
// activate them
|
||||
toggleSceneTreeComponentTreeWidgetInfos();
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
else {
|
||||
printf("G4OpenGLQtViewer::CreateMainWindow :: UIQt NOt found \n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!isTabbedView) { // we have to do a dialog
|
||||
|
||||
QWidget *glDialogWidget = getParentWidget();
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::CreateMainWindow :: getParent OK \n");
|
||||
#endif
|
||||
if (glDialogWidget != NULL) {
|
||||
glWidget->setParent(glDialogWidget);
|
||||
}
|
||||
@@ -204,9 +210,6 @@ void G4OpenGLQtViewer::CreateMainWindow (
|
||||
YPos = offset;
|
||||
}
|
||||
glDialogWidget->resize(getWinWidth(), getWinHeight());
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::CreateMainWindow :: resizing to %d %d \n",getWinWidth(), getWinHeight());
|
||||
#endif
|
||||
glDialogWidget->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
|
||||
glDialogWidget->show();
|
||||
}
|
||||
@@ -495,9 +498,6 @@ G4OpenGLQtViewer::G4OpenGLQtViewer (
|
||||
fTreeIconOpen = new QPixmap(icon1);
|
||||
fTreeIconClosed = new QPixmap(icon2);
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::G4OpenGLQtViewer END\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1120,7 +1120,7 @@ void G4OpenGLQtViewer::actionSaveImage() {
|
||||
}
|
||||
fLastExportSliderValue = exportDialog->getSliderValue();
|
||||
|
||||
if (exportImage(filename + "." + fExportImageFormat)) {
|
||||
if (exportImage(filename)) {
|
||||
// set the default format to current
|
||||
fDefaultExportImageFormat = format;
|
||||
}
|
||||
@@ -1443,11 +1443,6 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
|
||||
} else if (fAltKeyPress) {
|
||||
rotateQtSceneToggle(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
fNbRotation ++;
|
||||
fTimeRotation += lastMoveTime.elapsed();
|
||||
printf("G4OpenGLQtViewer %f \n",fTimeRotation/(float)fNbRotation);
|
||||
#endif
|
||||
|
||||
} else if (move) { // move
|
||||
moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
|
||||
@@ -1945,7 +1940,7 @@ QString G4OpenGLQtViewer::getEncoderPath() {
|
||||
*/
|
||||
QString G4OpenGLQtViewer::setEncoderPath(QString path) {
|
||||
if (path == "") {
|
||||
return "File does not exist";
|
||||
return "ppmtompeg is needed to encode in video format. It is available here: http://netpbm.sourceforge.net ";
|
||||
}
|
||||
|
||||
path = QDir::cleanPath(path);
|
||||
@@ -2527,19 +2522,10 @@ QWidget *G4OpenGLQtViewer::getParentWidget()
|
||||
}
|
||||
|
||||
if (found==false) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n");
|
||||
#endif
|
||||
dialog = new QDialog();
|
||||
}
|
||||
} else {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n");
|
||||
#endif
|
||||
dialog= new QDialog();
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLQtViewer::GetParentWidget fGLWidget\n");
|
||||
#endif
|
||||
}
|
||||
if (found) {
|
||||
return dialog;
|
||||
@@ -2549,21 +2535,20 @@ QWidget *G4OpenGLQtViewer::getParentWidget()
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtViewer::initSceneTreeComponent(){
|
||||
void G4OpenGLQtViewer::createSceneTreeComponent(){
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox("");
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
|
||||
fSceneTreeViewerButton = new QPushButton("Scene tree");
|
||||
fSceneTreeViewerButton->setStyleSheet ("text-align: left; padding: 5px; border:0px; ");
|
||||
fSceneTreeViewerButton->setIcon(*fTreeIconClosed);
|
||||
fSceneTreeViewerButton->setStyleSheet ("text-align: left; padding: 2px; border:0px; background:#e0e5ef;");
|
||||
fSceneTreeViewerButton->setIcon(*fTreeIconOpen);
|
||||
|
||||
vbox->addWidget(fSceneTreeViewerButton);
|
||||
connect(fSceneTreeViewerButton,SIGNAL(clicked()),this, SLOT(toggleSceneTreeViewerInfos()));
|
||||
|
||||
fSceneTreeViewerInfos = new QWidget();
|
||||
fSceneTreeViewerInfos->setStyleSheet ("padding: 0px ");
|
||||
fSceneTreeViewerInfos->setVisible(false);
|
||||
fSceneTreeViewerInfos->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
@@ -2597,7 +2582,8 @@ void G4OpenGLQtViewer::initSceneTreeComponent(){
|
||||
vLayout->addWidget(coutButtonWidget);
|
||||
|
||||
// reduce margins
|
||||
vLayout->setContentsMargins(5,5,5,5);
|
||||
vLayout->setContentsMargins(0,0,0,0);
|
||||
vbox->setContentsMargins(1,1,1,1);
|
||||
|
||||
|
||||
fSceneTreeComponentTreeWidget = new QTreeWidget();
|
||||
@@ -2669,23 +2655,24 @@ void G4OpenGLQtViewer::initSceneTreeComponent(){
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtViewer::initViewerPropertiesComponent() {
|
||||
void G4OpenGLQtViewer::createViewerPropertiesComponent() {
|
||||
|
||||
// add properties
|
||||
QGroupBox *groupBox = new QGroupBox("");
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
fViewerPropertiesButton = new QPushButton("Viewer properties");
|
||||
fViewerPropertiesButton->setStyleSheet ("text-align: left; padding: 5px; border:0px; ");
|
||||
fViewerPropertiesButton->setIcon(*fTreeIconClosed);
|
||||
fViewerPropertiesButton->setStyleSheet ("text-align: left; padding: 2px; border:0px; background:#e0e5ef;");
|
||||
|
||||
fViewerPropertiesButton->setIcon(*fTreeIconOpen);
|
||||
|
||||
vbox->addWidget(fViewerPropertiesButton);
|
||||
connect(fViewerPropertiesButton,SIGNAL(clicked()),this, SLOT(toggleSceneTreeComponentTreeWidgetInfos()));
|
||||
|
||||
// add properties content
|
||||
fSceneTreeComponentTreeWidgetInfos = new QTableWidget();
|
||||
fSceneTreeComponentTreeWidgetInfos->setVisible(false);
|
||||
fSceneTreeComponentTreeWidgetInfos->setStyleSheet ("padding: 0px ");
|
||||
vbox->addWidget(fSceneTreeComponentTreeWidgetInfos);
|
||||
vbox->setContentsMargins(1,1,1,1);
|
||||
|
||||
groupBox->setLayout(vbox);
|
||||
fSceneTreeWidget->layout()->addWidget(groupBox);
|
||||
@@ -2698,7 +2685,7 @@ void G4OpenGLQtViewer::initViewerPropertiesComponent() {
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtViewer::initPickingComponent(){
|
||||
void G4OpenGLQtViewer::createPickingComponent(){
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox("");
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
@@ -2708,8 +2695,8 @@ void G4OpenGLQtViewer::initPickingComponent(){
|
||||
QHBoxLayout *pickingInfoLayout = new QHBoxLayout();
|
||||
|
||||
fViewerPickingButton = new QPushButton("Picking informations");
|
||||
fViewerPickingButton->setStyleSheet ("text-align: left; padding: 5px; border:0px; ");
|
||||
fViewerPickingButton->setIcon(*fTreeIconClosed);
|
||||
fViewerPickingButton->setStyleSheet ("text-align: left; padding: 2px; border:0px; background:#e0e5ef;");
|
||||
fViewerPickingButton->setIcon(*fTreeIconOpen);
|
||||
|
||||
// initialise picking infos
|
||||
|
||||
@@ -2739,8 +2726,6 @@ void G4OpenGLQtViewer::initPickingComponent(){
|
||||
|
||||
fSceneTreeComponentPickingInfos = new QWidget();
|
||||
fSceneTreeComponentPickingInfos->setStyleSheet ("padding: 0px ");
|
||||
fSceneTreeComponentPickingScrollArea->setVisible(false);
|
||||
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
fSceneTreeComponentPickingInfos->setLayout (vLayout);
|
||||
@@ -2749,6 +2734,9 @@ void G4OpenGLQtViewer::initPickingComponent(){
|
||||
QSizePolicy vPolicy = fSceneTreeComponentPickingInfos->sizePolicy();
|
||||
vPolicy.setVerticalStretch(4);
|
||||
vbox->addWidget(fSceneTreeComponentPickingScrollArea);
|
||||
pickingInfoLayout->setContentsMargins(0,0,0,0);
|
||||
vLayout->setContentsMargins(0,0,0,0);
|
||||
vbox->setContentsMargins(1,1,1,1);
|
||||
|
||||
groupBox->setLayout(vbox);
|
||||
fSceneTreeWidget->layout()->addWidget(groupBox);
|
||||
@@ -2790,6 +2778,10 @@ void G4OpenGLQtViewer::DrawText(const G4Text& g4text)
|
||||
|
||||
if (!fGLWidget) return;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::G4GetThreadId() != G4Threading::MASTER_ID) return;
|
||||
#endif
|
||||
|
||||
G4VSceneHandler::MarkerSizeType sizeType;
|
||||
G4double size = fSceneHandler.GetMarkerSize(g4text,sizeType);
|
||||
|
||||
@@ -2826,7 +2818,7 @@ void G4OpenGLQtViewer::DrawText(const G4Text& g4text)
|
||||
position.z(),
|
||||
textCString,
|
||||
font);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2849,7 +2841,7 @@ void G4OpenGLQtViewer::addPVSceneTreeElement(const G4String& model, G4PhysicalVo
|
||||
}
|
||||
// try to init it
|
||||
if (fSceneTreeComponentTreeWidget == NULL) {
|
||||
initSceneTreeComponent();
|
||||
createSceneTreeComponent();
|
||||
}
|
||||
|
||||
// if no UI
|
||||
@@ -3232,9 +3224,6 @@ void G4OpenGLQtViewer::changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement
|
||||
} else {
|
||||
color = oldItem->data(2,Qt::UserRole).value<QColor>();
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("====color name:%s\n",color.name().toStdString().c_str());
|
||||
#endif
|
||||
changeQColorForTreeWidgetItem(subItem,color);
|
||||
}
|
||||
}
|
||||
@@ -3336,7 +3325,7 @@ void G4OpenGLQtViewer::addNonPVSceneTreeElement(
|
||||
}
|
||||
// try to init it
|
||||
if (fSceneTreeComponentTreeWidget == NULL) {
|
||||
initSceneTreeComponent();
|
||||
createSceneTreeComponent();
|
||||
}
|
||||
|
||||
// if no UI
|
||||
@@ -4615,19 +4604,90 @@ QString G4OpenGLQtViewer::GetCommandParameterList (
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
void G4OpenGLQtViewer::DoneWithMasterThread()
|
||||
{
|
||||
// Called by Main Thread !
|
||||
|
||||
// Useful to avoid two vis thread at the same time
|
||||
G4MUTEXLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
|
||||
}
|
||||
|
||||
void G4OpenGLQtViewer::SwitchToVisSubThread()
|
||||
{
|
||||
G4cout << "G4OpenGLQtViewer::SwitchToVisSubThread" << G4endl;
|
||||
// Called by VisSub Thread !
|
||||
|
||||
QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
|
||||
if (! qGLW) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the current QThread to its static variable
|
||||
SetQGLContextVisSubThread(QThread::currentThread());
|
||||
|
||||
// - Wait for the vis thread to set its QThread
|
||||
G4CONDTIONBROADCAST(&c1_VisSubThreadQtOpenGLContextInitialized);
|
||||
|
||||
// Unlock the vis thread if it is Qt Viewer
|
||||
G4CONDITIONWAIT(&c2_VisSubThreadQtOpenGLContextMoved, &mWaitForVisSubThreadQtOpenGLContextMoved);
|
||||
|
||||
// make context current
|
||||
qGLW->makeCurrent();
|
||||
}
|
||||
|
||||
void G4OpenGLQtViewer::DoneWithVisSubThread()
|
||||
{
|
||||
// Called by vis sub thread
|
||||
QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
|
||||
if (! qGLW) {
|
||||
return;
|
||||
}
|
||||
|
||||
// finish with this vis sub thread context
|
||||
qGLW->doneCurrent();
|
||||
|
||||
#if QT_VERSION > 0x050000
|
||||
// and move it back to the main thread
|
||||
qGLW->context()->moveToThread(fQGLContextMainThread);
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4OpenGLQtViewer::SwitchToMasterThread()
|
||||
{
|
||||
G4cout << "G4OpenGLQtViewer::SwitchToMasterThread" << G4endl;
|
||||
// Called by VisSub Thread !
|
||||
|
||||
QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
|
||||
if (! qGLW) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Useful to avoid two vis thread at the same time
|
||||
G4MUTEXUNLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
|
||||
qGLW->makeCurrent();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtViewer::MovingToVisSubThread(){
|
||||
// Called by Main Thread !
|
||||
|
||||
QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
|
||||
if (! qGLW) {
|
||||
return;
|
||||
}
|
||||
|
||||
// - Wait for the vis sub thread to set its QThread
|
||||
G4CONDITIONWAIT( &c1_VisSubThreadQtOpenGLContextInitialized, &mWaitForVisSubThreadQtOpenGLContextInitialized);
|
||||
|
||||
|
||||
// Set current QThread for the way back
|
||||
SetQGLContextMainThread(QThread::currentThread());
|
||||
|
||||
// finish with this main thread context
|
||||
qGLW->doneCurrent();
|
||||
#if QT_VERSION > 0x050000
|
||||
qGLW->context()->moveToThread(fQGLContextVisSubThread);
|
||||
#endif
|
||||
|
||||
G4CONDTIONBROADCAST(&c2_VisSubThreadQtOpenGLContextMoved);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLSceneHandler.cc 85263 2014-10-27 08:58:31Z gcosmo $
|
||||
// $Id: G4OpenGLSceneHandler.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -348,9 +348,6 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
G4Vector3D r = start; r.rotate(phi, viewpointDirection);
|
||||
G4Vector3D p = polymarker[iPoint] + r;
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf(".....G4OpenGLSceneHandler::AddPrimitive polyhedron QUADS VBO 5\n");
|
||||
#endif
|
||||
fOglVertex.push_back(p.x());
|
||||
fOglVertex.push_back(p.y());
|
||||
fOglVertex.push_back(p.z());
|
||||
@@ -747,9 +744,6 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
vertex[edgeCount].y(),
|
||||
vertex[edgeCount].z());
|
||||
#else
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf(".....G4OpenGLSceneHandler::AddPrimitive polyhedron QUADS VBO 2\n");
|
||||
#endif
|
||||
fOglVertex.push_back(vertex[edgeCount].x());
|
||||
fOglVertex.push_back(vertex[edgeCount].y());
|
||||
fOglVertex.push_back(vertex[edgeCount].z());
|
||||
@@ -817,9 +811,6 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
vertex[edgeCount].y(),
|
||||
vertex[edgeCount].z());
|
||||
#else
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf(".....G4OpenGLSceneHandler::AddPrimitive polyhedron QUADS VBO 3\n");
|
||||
#endif
|
||||
fOglVertex.push_back(vertex[edgeCount].x());
|
||||
fOglVertex.push_back(vertex[edgeCount].y());
|
||||
fOglVertex.push_back(vertex[edgeCount].z());
|
||||
@@ -993,9 +984,6 @@ void G4OpenGLSceneHandler::OptimizeVBOForCons(G4int aNoFaces){
|
||||
|
||||
void G4OpenGLSceneHandler::glBeginVBO(GLenum type) {
|
||||
fDrawArrayType = type;
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLSceneHandler::glBeginVBO %d\n",type);
|
||||
#endif
|
||||
#ifndef G4VIS_BUILD_OPENGLWT_DRIVER
|
||||
glGenBuffers(1,&fVertexBufferObject);
|
||||
glGenBuffers(1,&fIndicesBufferObject);
|
||||
@@ -1105,11 +1093,7 @@ void G4OpenGLSceneHandler::glEndVBO() {
|
||||
//----------------------------
|
||||
glBindBuffer(GL_ARRAY_BUFFER, fVertexBufferObject);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, fIndicesBufferObject);
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLSceneHandler::glEndVBO() To DrawElements:%d vertex and %d indices\n",fOglVertex.size()/6,fOglIndices.size());
|
||||
#endif
|
||||
|
||||
|
||||
// the fVertexPositionAttribute is inside the G4OpenGLViewer
|
||||
G4OpenGLViewer* pGLViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
|
||||
if (pGLViewer) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredQt.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLStoredQt.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// OpenGLStoredQt graphics system factory.
|
||||
@@ -57,9 +57,6 @@ G4VSceneHandler* G4OpenGLStoredQt::CreateSceneHandler
|
||||
|
||||
G4VViewer* G4OpenGLStoredQt::CreateViewer
|
||||
(G4VSceneHandler& scene, const G4String& name) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQt::CreateViewer \n");
|
||||
#endif
|
||||
G4VViewer* pView = 0;
|
||||
pView = new G4OpenGLStoredQtViewer
|
||||
((G4OpenGLStoredSceneHandler&) scene, name);
|
||||
@@ -76,9 +73,6 @@ G4VViewer* G4OpenGLStoredQt::CreateViewer
|
||||
G4cerr << "G4OpenGLStoredQt::CreateViewer: null pointer on"
|
||||
" new G4OpenGLStoredQtViewer." << G4endl;
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQt::CreateViewer END \n");
|
||||
#endif
|
||||
return pView;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,9 +141,6 @@ void G4OpenGLStoredQtSceneHandler::ClearStore () {
|
||||
// Should recreate the tree
|
||||
G4OpenGLQtViewer* pGLQtViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer);
|
||||
if ( pGLQtViewer ) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtSceneHandler::ClearStore_________________________________\n" );
|
||||
#endif
|
||||
pGLQtViewer->clearTreeWidget();
|
||||
}
|
||||
}
|
||||
@@ -155,13 +152,6 @@ void G4OpenGLStoredQtSceneHandler::ClearTransientStore () {
|
||||
G4OpenGLStoredSceneHandler::ClearTransientStore ();
|
||||
|
||||
// Should recreate the tree
|
||||
G4OpenGLQtViewer* pGLQtViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer);
|
||||
if ( pGLQtViewer ) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtSceneHandler::ClearTransient_________________________________\n" );
|
||||
#endif
|
||||
// pGLQtViewer->clearTreeWidget();
|
||||
}
|
||||
// Make sure screen corresponds to graphical database...
|
||||
// FIXME : L.Garnier April 2012 : Could cause a infinite loop ?
|
||||
if (fpViewer) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredQtViewer.cc 87164 2014-11-26 08:48:31Z gcosmo $
|
||||
// $Id: G4OpenGLStoredQtViewer.cc 94206 2015-11-09 08:11:59Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
|
||||
@@ -41,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qtabwidget.h>
|
||||
|
||||
G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
|
||||
(G4OpenGLStoredSceneHandler& sceneHandler,
|
||||
@@ -74,41 +75,36 @@ G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
|
||||
|
||||
void G4OpenGLStoredQtViewer::Initialise() {
|
||||
makeCurrent();
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::Initialise 1\n");
|
||||
#endif
|
||||
hide();
|
||||
|
||||
fQGLWidgetInitialiseCompleted = false;
|
||||
CreateMainWindow (this,QString(GetName()));
|
||||
|
||||
glDrawBuffer (GL_BACK);
|
||||
fQGLWidgetInitialiseCompleted = true;
|
||||
|
||||
// set the good tab active
|
||||
if (QGLWidget::parentWidget()) {
|
||||
QTabWidget *parentTab = dynamic_cast<QTabWidget*> (QGLWidget::parentWidget()->parent()) ;
|
||||
if (parentTab) {
|
||||
parentTab->setCurrentIndex(parentTab->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
fQGLWidgetInitialiseCompleted = true;
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::initializeGL () {
|
||||
|
||||
InitializeGLView ();
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL () 1 %d\n", this);
|
||||
#endif
|
||||
|
||||
if (fSceneHandler.GetScene() == 0) {
|
||||
fHasToRepaint =false;
|
||||
} else {
|
||||
fHasToRepaint =true;
|
||||
}
|
||||
|
||||
|
||||
// Set the component visible
|
||||
setVisible(true) ;
|
||||
// setVisible(true) ;
|
||||
|
||||
// and update it immediatly before wait for SessionStart() (batch mode)
|
||||
QCoreApplication::sendPostedEvents () ;
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL END\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
@@ -187,20 +183,11 @@ G4bool G4OpenGLStoredQtViewer::TOSelected(size_t)
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::DrawView () {
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::G4GetThreadId() == G4Threading::MASTER_ID) {
|
||||
updateQWidget();
|
||||
}
|
||||
#else
|
||||
updateQWidget();
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
|
||||
#endif
|
||||
makeCurrent();
|
||||
G4ViewParameters::DrawingStyle dstyle = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
@@ -221,9 +208,6 @@ void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
}
|
||||
if(dstyle!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView DANS LE IF\n");
|
||||
#endif
|
||||
|
||||
HaloingFirstPass ();
|
||||
DrawDisplayLists ();
|
||||
@@ -239,15 +223,9 @@ void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
// If kernel visit was needed, drawing and FinishView will already
|
||||
// have been done, so...
|
||||
if (!kernelVisitWasNeeded) {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("************************** G4OpenGLStoredQtViewer::ComputeView Don't need kernel Visit \n");
|
||||
#endif
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("************************** G4OpenGLStoredQtViewer::ComputeView need kernel Visit \n");
|
||||
#endif
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
@@ -255,9 +233,6 @@ void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("*************************** CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
} else { // ADD TO AVOID KernelVisit=1 and nothing to display
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
@@ -269,9 +244,6 @@ void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
savePPMToTemp();
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
|
||||
#endif
|
||||
fHasToRepaint = true;
|
||||
}
|
||||
|
||||
@@ -300,9 +272,6 @@ void G4OpenGLStoredQtViewer::paintGL()
|
||||
{
|
||||
updateToolbarAndMouseContextMenu();
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::paintGL \n");
|
||||
#endif
|
||||
if (fPaintEventLock) {
|
||||
// return ;
|
||||
}
|
||||
@@ -311,9 +280,6 @@ void G4OpenGLStoredQtViewer::paintGL()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ready:%d fHasTo:%d??\n",fReadyToPaint,fHasToRepaint);
|
||||
#endif
|
||||
if (!fQGLWidgetInitialiseCompleted) {
|
||||
fPaintEventLock = false;
|
||||
return;
|
||||
@@ -337,9 +303,6 @@ void G4OpenGLStoredQtViewer::paintGL()
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
|
||||
#endif
|
||||
// Ensure that we really draw the BACK buffer
|
||||
glDrawBuffer (GL_BACK);
|
||||
|
||||
@@ -350,9 +313,6 @@ void G4OpenGLStoredQtViewer::paintGL()
|
||||
|
||||
fHasToRepaint = false;
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",fReadyToPaint);
|
||||
#endif
|
||||
fPaintEventLock = false;
|
||||
}
|
||||
|
||||
@@ -389,9 +349,11 @@ void G4OpenGLStoredQtViewer::wheelEvent (QWheelEvent * event)
|
||||
G4wheelEvent(event);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::showEvent (QShowEvent *)
|
||||
void G4OpenGLStoredQtViewer::showEvent (QShowEvent *)
|
||||
{
|
||||
fHasToRepaint = true;
|
||||
if (fQGLWidgetInitialiseCompleted) {
|
||||
fHasToRepaint = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc 87164 2014-11-26 08:48:31Z gcosmo $
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -427,7 +427,9 @@ end_of_display_list_reuse_test:
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
if (pViewer) {
|
||||
pViewer->g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
}
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredViewer.cc 85582 2014-10-31 09:07:30Z gcosmo $
|
||||
// $Id: G4OpenGLStoredViewer.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -48,7 +48,8 @@ G4OpenGLStoredViewer::G4OpenGLStoredViewer
|
||||
(G4OpenGLStoredSceneHandler& sceneHandler):
|
||||
G4VViewer (sceneHandler, -1),
|
||||
G4OpenGLViewer (sceneHandler),
|
||||
fG4OpenGLStoredSceneHandler (sceneHandler)
|
||||
fG4OpenGLStoredSceneHandler (sceneHandler),
|
||||
fDepthTestEnable(true)
|
||||
{
|
||||
fLastVP = fDefaultVP; // Not sure if this gets executed before or
|
||||
// after G4VViewer::G4VViewer!! Doesn't matter much.
|
||||
@@ -129,17 +130,11 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
}
|
||||
|
||||
void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredViewer::DrawDisplayLists \n");
|
||||
#endif
|
||||
|
||||
const G4Planes& cutaways = fVP.GetCutawayPlanes();
|
||||
G4bool cutawayUnion = fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
|
||||
const size_t nCutaways = cutawayUnion? cutaways.size(): 1;
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredViewer::DrawDisplayLists");
|
||||
#endif
|
||||
G4int iPass = 1;
|
||||
G4bool secondPassForTransparencyRequested = false;
|
||||
G4bool thirdPassForNonHiddenMarkersRequested = false;
|
||||
@@ -212,7 +207,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@@ -291,7 +286,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@@ -375,7 +370,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLStoredXViewer.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "G4OpenGLStoredSceneHandler.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
G4OpenGLStoredXViewer::
|
||||
G4OpenGLStoredXViewer (G4OpenGLStoredSceneHandler& sceneHandler,
|
||||
@@ -77,8 +78,18 @@ void G4OpenGLStoredXViewer::DrawView () {
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLStoredXViewer::DrawView\n");
|
||||
#endif
|
||||
//Make sure current viewer is attached and clean...
|
||||
glXMakeCurrent (dpy, win, cx);
|
||||
// //Make sure current viewer is attached and clean...
|
||||
//#ifdef G4MULTITHREADED
|
||||
// G4int thread_id = G4Threading::G4GetThreadId();
|
||||
// G4cout << "G4OpenGLStoredXViewer::DrawView: thread " << thread_id << G4endl;
|
||||
// if (thread_id < 0) {
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
// } else {
|
||||
// glXMakeCurrent (dpy, win, cxVisSubThread);
|
||||
// }
|
||||
//#else
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
//#endif
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXm.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLStoredXm.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -42,10 +42,10 @@
|
||||
#include "G4OpenGLXmViewerMessenger.hh"
|
||||
|
||||
G4OpenGLStoredXm::G4OpenGLStoredXm ():
|
||||
G4VGraphicsSystem ("OpenGLStoredXm",
|
||||
"OGLSXm",
|
||||
G4VisFeaturesOfOpenGLSXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
G4OpenGLXm ("OpenGLStoredXm",
|
||||
"OGLSXm",
|
||||
G4VisFeaturesOfOpenGLSXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXmViewerMessenger::GetInstance();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXmViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLStoredXmViewer.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "G4OpenGLStoredSceneHandler.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
G4OpenGLStoredXmViewer::
|
||||
G4OpenGLStoredXmViewer (G4OpenGLStoredSceneHandler& sceneHandler,
|
||||
@@ -77,8 +78,18 @@ void G4OpenGLStoredXmViewer::DrawView () {
|
||||
printf("G4OpenGLStoredXmViewer::DrawView \n");
|
||||
#endif
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
glXMakeCurrent (dpy, win, cx);
|
||||
// //Make sure current viewer is attached and clean...
|
||||
//#ifdef G4MULTITHREADED
|
||||
// G4int thread_id = G4Threading::G4GetThreadId();
|
||||
// G4cout << "G4OpenGLStoredXmViewer::DrawView: thread " << thread_id << G4endl;
|
||||
// if (thread_id < 0) {
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
// } else {
|
||||
// glXMakeCurrent (dpy, win, cxVisSubThread);
|
||||
// }
|
||||
//#else
|
||||
// glXMakeCurrent (dpy, win, cxMaster);
|
||||
//#endif
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#ifdef G4OPENGL_VERSION_2
|
||||
|
||||
#define G4DEBUG_VIS_OGL 1
|
||||
|
||||
#include "G4OpenGLVboDrawer.hh"
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLWT_DRIVER
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewer.cc 87443 2014-12-04 12:26:31Z gunter $
|
||||
// $Id: G4OpenGLViewer.cc 94428 2015-11-16 12:40:02Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -61,8 +61,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
//#define G4DEBUG_VIS_OGL 1
|
||||
|
||||
G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
|
||||
G4VViewer (scene, -1),
|
||||
#ifdef G4OPENGL_VERSION_2
|
||||
@@ -119,9 +117,6 @@ fIsGettingPickInfos(false)
|
||||
,fnMatrixUniform(0)
|
||||
#endif
|
||||
{
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer:: Creation\n");
|
||||
#endif
|
||||
// Make changes to view parameters for OpenGL...
|
||||
fVP.SetAutoRefresh(true);
|
||||
fDefaultVP.SetAutoRefresh(true);
|
||||
@@ -200,9 +195,6 @@ void G4OpenGLViewer::InitializeGLView ()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::InitializeGLView\n");
|
||||
#endif
|
||||
|
||||
fWinSize_x = fVP.GetWindowSizeHintX();
|
||||
fWinSize_y = fVP.GetWindowSizeHintY();
|
||||
@@ -224,10 +216,7 @@ void G4OpenGLViewer::InitializeGLView ()
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::InitializeGLView END\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLViewer::ClearView () {
|
||||
ClearViewWithoutFlush();
|
||||
@@ -275,9 +264,6 @@ void G4OpenGLViewer::ResizeWindow(unsigned int aWidth, unsigned int aHeight) {
|
||||
*/
|
||||
void G4OpenGLViewer::ResizeGLView()
|
||||
{
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::ResizeGLView %d %d %#lx\n",fWinSize_x,fWinSize_y,(unsigned long)this);
|
||||
#endif
|
||||
// Check size
|
||||
GLint dims[2];
|
||||
dims[0] = 0;
|
||||
@@ -321,8 +307,8 @@ void G4OpenGLViewer::SetView () {
|
||||
lightPosition [2] = fVP.GetActualLightpointDirection().z();
|
||||
lightPosition [3] = 0.;
|
||||
// Light position is "true" light direction, so must come after gluLookAt.
|
||||
GLfloat ambient [] = { 0.2, 0.2, 0.2, 1.};
|
||||
GLfloat diffuse [] = { 0.8, 0.8, 0.8, 1.};
|
||||
GLfloat ambient [] = { 0.2f, 0.2f, 0.2f, 1.f};
|
||||
GLfloat diffuse [] = { 0.8f, 0.8f, 0.8f, 1.f};
|
||||
glEnable (GL_LIGHT0);
|
||||
glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
|
||||
glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||
@@ -364,10 +350,10 @@ void G4OpenGLViewer::SetView () {
|
||||
glScaled(scaleFactor.x(),scaleFactor.y(),scaleFactor.z());
|
||||
|
||||
if (fVP.GetFieldHalfAngle() == 0.) {
|
||||
glOrtho (left, right, bottom, top, pnear, pfar);
|
||||
g4GlOrtho (left, right, bottom, top, pnear, pfar);
|
||||
}
|
||||
else {
|
||||
glFrustum (left, right, bottom, top, pnear, pfar);
|
||||
g4GlFrustum (left, right, bottom, top, pnear, pfar);
|
||||
}
|
||||
|
||||
glMatrixMode (GL_MODELVIEW); // apply further transformations to scene.
|
||||
@@ -554,6 +540,7 @@ std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x
|
||||
p++;
|
||||
p++;
|
||||
for (GLuint j = 0; j < nnames; ++j) {
|
||||
oss.clear();
|
||||
GLuint name = *p++;
|
||||
pickMap->setHitNumber(i);
|
||||
pickMap->setSubHitNumber(j);
|
||||
@@ -634,9 +621,6 @@ GLubyte* G4OpenGLViewer::grabPixels
|
||||
|
||||
bool G4OpenGLViewer::printEPS() {
|
||||
bool res;
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::printEPS file:%s Vec:%d Name:%s\n",getRealPrintFilename().c_str(),fVectoredPs,GetName().c_str());
|
||||
#endif
|
||||
|
||||
// Change the LC_NUMERIC value in order to have "." separtor and not ","
|
||||
// This case is only useful for French, Canadien...
|
||||
@@ -668,10 +652,6 @@ bool G4OpenGLViewer::printEPS() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::printEPS END\n");
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -684,9 +664,6 @@ bool G4OpenGLViewer::printNonVectoredEPS () {
|
||||
int width = getRealExportWidth();
|
||||
int height = getRealExportHeight();
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d col:%d fWinX:%d fWinY:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour,fWinSize_x,fWinSize_y);
|
||||
#endif
|
||||
FILE* fp;
|
||||
GLubyte* pixels;
|
||||
GLubyte* curpix;
|
||||
@@ -856,7 +833,7 @@ bool G4OpenGLViewer::exportImage(std::string name, int width, int height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((width =! -1) && (height != -1)) {
|
||||
if ((width != -1) && (height != -1)) {
|
||||
setExportSize(width, height);
|
||||
}
|
||||
|
||||
@@ -1255,10 +1232,6 @@ void G4OpenGLViewer::rotateSceneInViewDirection(G4double dx, G4double dy)
|
||||
|
||||
//phi spin stuff here
|
||||
|
||||
#ifdef G4DEBUG_VIS_OGL
|
||||
printf("G4OpenGLViewer::rotateScene dx:%f dy:%f delta:%f\n",dx,dy, fRot_sens);
|
||||
#endif
|
||||
|
||||
vp = fVP.GetViewpointDirection ().unit();
|
||||
up = fVP.GetUpVector ().unit();
|
||||
|
||||
@@ -1437,6 +1410,52 @@ void G4OpenGLViewer::g4GluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
|
||||
glTranslatef(-eyex, -eyey, -eyez);
|
||||
}
|
||||
|
||||
void G4OpenGLViewer::g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) {
|
||||
// glOrtho (left, right, bottom, top, near, far);
|
||||
|
||||
GLdouble a = 2.0 / (right - left);
|
||||
GLdouble b = 2.0 / (top - bottom);
|
||||
GLdouble c = -2.0 / (zFar - zNear);
|
||||
|
||||
GLdouble tx = - (right + left)/(right - left);
|
||||
GLdouble ty = - (top + bottom)/(top - bottom);
|
||||
GLdouble tz = - (zFar + zNear)/(zFar - zNear);
|
||||
|
||||
GLdouble ortho[16] = {
|
||||
a, 0, 0, 0,
|
||||
0, b, 0, 0,
|
||||
0, 0, c, 0,
|
||||
tx, ty, tz, 1
|
||||
};
|
||||
glMultMatrixd(ortho);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLViewer::g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) {
|
||||
// glFrustum (left, right, bottom, top, near, far);
|
||||
|
||||
GLdouble deltaX = right - left;
|
||||
GLdouble deltaY = top - bottom;
|
||||
GLdouble deltaZ = zFar - zNear;
|
||||
|
||||
GLdouble a = 2.0f * zNear / deltaX;
|
||||
GLdouble b = 2.0f * zNear / deltaY;
|
||||
GLdouble c = (right + left) / deltaX;
|
||||
GLdouble d = (top + bottom) / deltaY;
|
||||
GLdouble e = -(zFar + zNear) / (zFar - zNear);
|
||||
GLdouble f = -2.0f * zFar * zNear / deltaZ;
|
||||
|
||||
GLdouble proj[16] = {
|
||||
a, 0, 0, 0,
|
||||
0, b, 0, 0,
|
||||
c, d, e, -1.0f,
|
||||
0, 0, f, 0
|
||||
};
|
||||
|
||||
glMultMatrixd(proj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4OPENGL_VERSION_2
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.cc 83403 2014-08-21 15:07:30Z gcosmo $
|
||||
// $Id: G4OpenGLXViewer.cc 92942 2015-09-22 07:31:39Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -34,13 +34,10 @@
|
||||
#ifdef G4VIS_BUILD_OPENGLX_DRIVER
|
||||
|
||||
#include "G4OpenGLXViewer.hh"
|
||||
#include "G4VViewer.hh"
|
||||
|
||||
#include "G4OpenGLSceneHandler.hh"
|
||||
|
||||
#include "G4OpenGLFontBaseStore.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
@@ -49,12 +46,16 @@
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xmu/StdCmap.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
int G4OpenGLXViewer::snglBuf_RGBA[12] =
|
||||
{ GLX_RGBA,
|
||||
@@ -91,36 +92,14 @@ extern "C" {
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::SetView () {
|
||||
Bool success = glXMakeCurrent (dpy, win, cx);
|
||||
if (!success) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer failed to attach a GLX context."
|
||||
<< G4endl;
|
||||
GLint error = GL_NO_ERROR;
|
||||
while ((error = glGetError()) != GL_NO_ERROR) {
|
||||
switch (error) {
|
||||
case GL_INVALID_ENUM :
|
||||
G4cout << "GL Error: GL_INVALID_ENUM" << G4endl;break;
|
||||
case GL_INVALID_VALUE :
|
||||
G4cout << "GL Error: GL_INVALID_VALUE" << G4endl;break;
|
||||
case GL_INVALID_OPERATION :
|
||||
G4cout << "GL Error: GL_INVALID_OPERATION" << G4endl;break;
|
||||
case GL_OUT_OF_MEMORY :
|
||||
G4cout << "GL Error: GL_OUT_OF_MEMORY" << G4endl;break;
|
||||
case GL_STACK_UNDERFLOW :
|
||||
G4cout << "GL Error: GL_STACK_UNDERFLOW" << G4endl;break;
|
||||
case GL_STACK_OVERFLOW :
|
||||
G4cout << "GL Error: GL_STACK_OVERFLOW" << G4endl;break;
|
||||
default :
|
||||
G4cout << "GL Error: " << error << G4endl;break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
G4OpenGLViewer::SetView ();
|
||||
G4OpenGLViewer::SetView ();
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::ShowView () {
|
||||
#ifdef G4MULTITHREADED
|
||||
// G4int thread_id = G4Threading::G4GetThreadId();
|
||||
// G4cout << "G4OpenGLXViewer::ShowView: thread " << thread_id << G4endl;
|
||||
#endif
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propagated before progressing.
|
||||
glFlush ();
|
||||
@@ -137,13 +116,33 @@ void G4OpenGLXViewer::ShowView () {
|
||||
}
|
||||
else if (event.type == ButtonPress && event.xbutton.button == 2) break;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
void G4OpenGLXViewer::SwitchToVisSubThread()
|
||||
{
|
||||
// G4cout << "G4OpenGLXViewer::SwitchToVisSubThread" << G4endl;
|
||||
cxVisSubThread = glXCreateContext (dpy, vi, cxMaster, true);
|
||||
glXMakeCurrent (dpy, win, cxVisSubThread);
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::SwitchToMasterThread()
|
||||
{
|
||||
// G4cout << "G4OpenGLXViewer::SwitchToMasterThread" << G4endl;
|
||||
glXMakeCurrent (dpy, win, cxMaster);
|
||||
// and destroy sub-thread context
|
||||
glXDestroyContext (dpy, cxVisSubThread);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void G4OpenGLXViewer::GetXConnection () {
|
||||
// get a connection.
|
||||
dpy = XOpenDisplay (0);
|
||||
dpy = XOpenDisplay (0); // Uses DISPLAY environment variable.
|
||||
if (!dpy) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't open display." << G4endl;
|
||||
@@ -171,9 +170,9 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create a GLX context
|
||||
cx = glXCreateContext (dpy, vi, 0, true);
|
||||
if (!cx) {
|
||||
// create the master GLX context
|
||||
cxMaster = glXCreateContext (dpy, vi, 0, true);
|
||||
if (!cxMaster) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't create context."
|
||||
<< G4endl;
|
||||
@@ -305,7 +304,7 @@ void G4OpenGLXViewer::CreateMainWindow () {
|
||||
XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
|
||||
|
||||
// connect the context to a window
|
||||
Bool success = glXMakeCurrent (dpy, win, cx);
|
||||
Bool success = glXMakeCurrent (dpy, win, cxMaster);
|
||||
if (!success) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer failed to attach a GLX context."
|
||||
@@ -331,7 +330,6 @@ void G4OpenGLXViewer::CreateMainWindow () {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::CreateFontLists()
|
||||
@@ -522,7 +520,7 @@ G4OpenGLXViewer::~G4OpenGLXViewer () {
|
||||
if (fViewId >= 0) {
|
||||
//Close a window from here
|
||||
glXMakeCurrent (dpy, None, NULL);
|
||||
glXDestroyContext (dpy, cx);
|
||||
glXDestroyContext (dpy, cxMaster);
|
||||
if (win) XDestroyWindow (dpy, win); // ...if already deleted in
|
||||
// sub-class G4OpenGLXmViewer.
|
||||
XFlush (dpy);
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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:$
|
||||
//
|
||||
// John Allison 16th July 2015
|
||||
// Base class for OpenGLImmediate/StoredXm graphics system factories.
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
|
||||
|
||||
#include "G4OpenGLXm.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIbatch.hh"
|
||||
|
||||
G4OpenGLXm::G4OpenGLXm (const G4String& name,
|
||||
const G4String& nickname,
|
||||
const G4String& description,
|
||||
Functionality f):
|
||||
G4VGraphicsSystem (name,
|
||||
nickname,
|
||||
description,
|
||||
f)
|
||||
{}
|
||||
|
||||
G4bool G4OpenGLXm::IsUISessionCompatible () const
|
||||
{
|
||||
G4bool isCompatible = false;
|
||||
G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetSession();
|
||||
|
||||
// If session is a batch session, it may be:
|
||||
// a) this is a batch job (the user has not instantiated any UI session);
|
||||
// b) we are currently processing a UI command, in which case the UI
|
||||
// manager creates a temporary batch session and to find out if there is
|
||||
// a genuine UI session that the user has instantiated we must drill
|
||||
// down through previous sessions to a possible non-batch session.
|
||||
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
session = batch->GetPreviousSession();
|
||||
}
|
||||
|
||||
// Xm windows are not appropriate in a batch session.
|
||||
if (session) {
|
||||
// If non-zero, this is the originating non-batch session
|
||||
// The user has instantiated a UI session...
|
||||
isCompatible = true;
|
||||
}
|
||||
|
||||
return isCompatible;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmViewer.cc 68043 2013-03-13 14:27:49Z gcosmo $
|
||||
// $Id: G4OpenGLXmViewer.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -645,7 +645,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
|
||||
win = XtWindow (glxarea);
|
||||
|
||||
glXMakeCurrent (dpy, win, cx);
|
||||
glXMakeCurrent (dpy, win, cxMaster);
|
||||
|
||||
// This should be add AFTER glXMakeCurrent done because it will fire a resizeCallback
|
||||
XtAddCallback (glxarea,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc 87695 2014-12-17 09:35:24Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th June 1997
|
||||
@@ -59,7 +59,8 @@ void G4OpenGLXmViewer::expose_callback (Widget w,
|
||||
|
||||
pView->ResizeWindow(width,height);
|
||||
|
||||
glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cx);
|
||||
//??????????????????????????? This might be a problem in MT mode.
|
||||
glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cxMaster);
|
||||
|
||||
pView->SetView ();
|
||||
pView->ClearView ();
|
||||
|
||||
Reference in New Issue
Block a user