ASPiK SDK
win32openglview.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __win32openglview__
6 #define __win32openglview__
7 
8 #include "../iplatformopenglview.h"
9 
10 #if VSTGUI_OPENGL_SUPPORT
11 #if WINDOWS
12 
13 #include <windows.h>
14 
15 namespace VSTGUI {
16 class Win32Frame;
17 
18 //-----------------------------------------------------------------------------
19 class Win32OpenGLView : public IPlatformOpenGLView
20 {
21 public:
22  Win32OpenGLView (Win32Frame* win32Frame);
23  ~Win32OpenGLView () noexcept;
24 
25  bool init (IOpenGLView* view, PixelFormat* pixelFormat = nullptr) override;
26  void remove () override;
27 
28  void invalidRect (const CRect& rect) override;
29  void viewSizeChanged (const CRect& visibleSize) override;
30 
31  bool makeContextCurrent () override;
32  bool lockContext () override;
33  bool unlockContext () override;
34 
35  void swapBuffers () override;
36 protected:
37  static void initWindowClass ();
38  static void destroyWindowClass ();
39  static LONG_PTR WINAPI WindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
40 
41  bool createWindow (PixelFormat* pixelFormat);
42  bool setupPixelFormt (PixelFormat* pixelFormat);
43 
44  Win32Frame* win32Frame;
45  IOpenGLView* view;
46  HWND windowHandle;
47 
48  HDC deviceContext;
49  HGLRC openGLContext;
50  CRITICAL_SECTION lock;
51  static int32_t instanceCount;
52 };
53 
54 } // namespace
55 
56 #endif // WINDOWS
57 #endif // VSTGUI_OPENGL_SUPPORT
58 
59 #endif // __win32openglview__
Definition: customcontrols.cpp:8