68  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
 
   69    ::TranslateMessage(&event);
 
   70    ::DispatchMessage (&event);
 
   99  static const char className[] = 
"G4OpenGLWin32";
 
  100  static G4bool done = 
false;
 
  103    wc.style = CS_HREDRAW | CS_VREDRAW;
 
  107    wc.hInstance = ::GetModuleHandle(NULL);
 
  108    wc.hIcon = LoadIcon  (NULL, IDI_APPLICATION);
 
  109    wc.hCursor = LoadCursor(NULL,IDC_CROSS);
 
  110    wc.hbrBackground = NULL;
 
  113    ::RegisterClass(&wc);
 
  119  G4int x_res=GetSystemMetrics(SM_CXSCREEN);
 
  120  G4int y_res=GetSystemMetrics(SM_CYSCREEN);
 
  131               ::GetModuleHandle(NULL),
 
  135  ::SetWindowLongPtr(
fWindow,GWLP_USERDATA,LONG_PTR(
this));
 
  152  ::SetForegroundWindow(
fWindow);
 
  153  ::ShowWindow(
fWindow,SW_SHOWDEFAULT);
 
  173,fInCreateWindow(false)
 
  187    if(wglGetCurrentContext()!=NULL) wglMakeCurrent(NULL,NULL);
 
  194      ::SetWindowLongPtr(
fWindow,GWLP_USERDATA,LONG(NULL));
 
  216                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  218        This->fWinSize_x = (
G4int) LOWORD(aLParam);
 
  219        This->fWinSize_y = (
G4int) HIWORD(aLParam);
 
  220        if (!This->fInCreateWindow) {
 
  222          glViewport(0, 0, This->fWinSize_x, This->fWinSize_y);
 
  231      BeginPaint(aWindow, &
ps);
 
  233                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  237        if(!This->fInCreateWindow) {
 
  243      EndPaint(aWindow, &
ps);
 
  247    case WM_LBUTTONDOWN: {
 
  249                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  250      This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
 
  254    case WM_RBUTTONDOWN: {
 
  256                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  257      This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
 
  263                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  264      This->ReleaseMouse();
 
  270                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  271      This->ReleaseMouse();
 
  275    case WM_MOUSEHOVER: {
 
  277                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  278      This->fMouseHovered = 
true;
 
  282    case WM_MOUSELEAVE: {
 
  284                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  285      This->fMouseHovered = 
false;
 
  291                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  293      if (!This->fMouseHovered) {
 
  296        tme.cbSize = 
sizeof(tme);
 
  297        tme.dwFlags = TME_HOVER | TME_LEAVE;
 
  298        tme.hwndTrack = aWindow;
 
  299        tme.dwHoverTime = HOVER_DEFAULT;
 
  300        ::TrackMouseEvent(&tme);
 
  301        This->fMouseHovered = 
true;
 
  304      if (This->fMousePressed) {
 
  307        G4int dx = x - This->fMousePressedX;
 
  308        G4int dy = y - This->fMousePressedY;
 
  309        This->fMousePressedX = x;
 
  310        This->fMousePressedY = y;
 
  312        if (aWParam == MK_LBUTTON) {  
 
  313          This->SetRotation(dx, dy);
 
  316        if (aWParam == MK_RBUTTON) {  
 
  317          This->SetShift(dx, dy);
 
  328    case WM_MOUSEWHEEL: {
 
  330                   ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
 
  332      G4int delta = (short) HIWORD(aWParam);
 
  334      This->SetZoom(delta);
 
  343      return DefWindowProc(aWindow, aMessage, aWParam, aLParam);
 
  357  PIXELFORMATDESCRIPTOR pfd;
 
  358  pfd.nSize = 
sizeof(PIXELFORMATDESCRIPTOR);
 
  365  pfd.iPixelType = PFD_TYPE_RGBA;
 
  376  pfd.cAccumRedBits = 16;
 
  377  pfd.cAccumGreenBits = 16;
 
  378  pfd.cAccumBlueBits = 16;
 
  379  pfd.cAccumAlphaBits = 0;
 
  381  pfd.cStencilBits = 8;
 
  383  pfd.iLayerType = PFD_MAIN_PLANE;
 
  386  pfd.dwVisibleMask = 0;
 
  387  pfd.dwDamageMask = 0;
 
  389  G4int pixelIndex = ::ChoosePixelFormat(aHdc,&pfd);
 
  392    if (::DescribePixelFormat(aHdc, 
 
  394                  sizeof(PIXELFORMATDESCRIPTOR), 
 
  399  if (::SetPixelFormat(aHdc,pixelIndex,&pfd)==
FALSE) 
return false;
 
  438  const G4double dxScene = dx*sceneRadius/scale;
 
  439  const G4double dyScene = dy*sceneRadius/scale;
 
  457  newViewpointDirection += dx*x_prime/scale;
 
  458  newViewpointDirection += dy*y_prime/scale;
 
  463      newUpVector += dx*x_prime/scale;
 
  464      newUpVector += dy*y_prime/scale;
 
static constexpr double ps
static constexpr double deg
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
void SetZoom(G4int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
virtual void CreateMainWindow()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
G4OpenGLWin32Viewer(G4OpenGLSceneHandler &scene)
void ShowView()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void SetShift(G4int, G4int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void SetView()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void SetRotation(G4int, G4int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void ReleaseMouse()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static G4bool SetWindowPixelFormat(HDC)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void TrackMouse(G4int, G4int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
virtual ~G4OpenGLWin32Viewer()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void CreateGLWin32Context()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void GetWin32Connection()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
const G4VisExtent & GetExtent() const
G4Scene * GetScene() const
G4VSceneHandler * GetSceneHandler() const
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4int GetWindowAbsoluteLocationHintY(G4int) const
unsigned int GetWindowSizeHintX() const
const G4Vector3D & GetViewpointDirection() const
G4double GetFieldHalfAngle() const
void SetDolly(G4double dolly)
G4int GetWindowAbsoluteLocationHintX(G4int) const
void IncrementPan(G4double right, G4double up)
const G4Vector3D & GetUpVector() const
void SetUpVector(const G4Vector3D &upVector)
RotationStyle GetRotationStyle() const
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
unsigned int GetWindowSizeHintY() const
G4double GetDolly() const
G4double GetExtentRadius() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
BasicVector3D< T > unit() const