ViewerWin32.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Win
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2011, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeWin/Base.h"
16 #include "CeeWin/OpenGLContextSpecWin.h"
17 
18 #include "CeeVisualization/Viewer.h"
19 
20 #include <windows.h>
21 
22 namespace cee {
23 
24 namespace vis {
25 class OpenGLContextGroup;
26 }
27 
28 namespace win {
29 
30 class OpenGLContextWin;
31 
32 
33 //==================================================================================================
34 //
35 //
36 //
37 //==================================================================================================
38 class CEE_WIN_EXPORT ViewerWin32 : public vis::Viewer
39 {
40 public:
41  ViewerWin32();
42  ~ViewerWin32();
43 
44  bool createOpenGLContext(vis::OpenGLContextGroup* contextGroup, HWND hWnd, const OpenGLContextSpecWin& spec = OpenGLContextSpecWin());
45  bool createOpenGLContext(vis::OpenGLContextGroup* contextGroup, int windowHandleAsInt, const OpenGLContextSpecWin& spec = OpenGLContextSpecWin());
46  bool createSharedOpenGLContext(vis::OpenGLContextGroup* contextGroup, ViewerWin32* shareWithViewer, HWND hWnd);
47  bool createSharedOpenGLContext(vis::OpenGLContextGroup* contextGroup, ViewerWin32* shareWithViewer, int windowHandleAsInt);
48  bool createSoftwareOpenGLContext(vis::OpenGLContextGroup* contextGroup, HWND hWnd);
49  bool createSoftwareOpenGLContext(vis::OpenGLContextGroup* contextGroup, int windowHandleAsInt);
50 
51  void deleteOpenGLContext();
52 
53  void swapBuffers();
54 
55  static bool supportsHardwareOpenGL(HWND hWnd);
56  static bool supportsHardwareOpenGL(int windowHandleAsInt);
57 
58 private:
59  virtual bool internal_makeOpenGLContextCurrent();
60  virtual cvf::OpenGLContext* internal_cvfOpenGLContext();
61  virtual void internal_requestRedraw();
62  virtual void internal_requestImmediateRedraw();
63 
64  bool createFirstOpenGLContext(vis::OpenGLContextGroup* contextGroup, HWND hWnd, const OpenGLContextSpecWin& spec, bool forceSoftwareContext);
65 
66 
67 private:
68  CEE_PRIVATE_IMPL(ViewerWin32);
69 };
70 
71 }
72 }
Subclass of viewers for setting up the OpenGL render context for Win32 applications.
Definition: ViewerWin32.h:38
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
Thin wrapper class for integrating Ceetron Desktop Components with a UI toolkit.
Definition: Viewer.h:30
A context group associates OpenGLContext instances that share OpenGL resources such as shader objects...
Definition: OpenGLContextGroup.h:32
Specification class for creation of a Windows OpenGL context.
Definition: OpenGLContextSpecWin.h:28