ASPiK SDK
iplatformopenglview.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 __iplatformopenglview__
6 #define __iplatformopenglview__
7 
8 #include "../vstguifwd.h"
9 
11 
12 #if VSTGUI_OPENGL_SUPPORT
13 
14 namespace VSTGUI {
15 class IPlatformFrame;
16 
17 //-----------------------------------------------------------------------------
18 struct PixelFormat
19 {
20  // TODO: add more if we need more...
21 
22  enum {
23  kDoubleBuffered = 1 << 0,
24  kMultiSample = 1 << 2,
25  kModernOpenGL = 1 << 3 // Mac only. Indicates to use the NSOpenGLProfileVersion3_2Core.
26  };
27 
28  uint32_t depthBufferSize {32};
29  uint32_t stencilBufferSize {0};
30  uint32_t samples {0};
31  uint32_t flags {kDoubleBuffered};
32 
33  PixelFormat () = default;
34  PixelFormat (const PixelFormat&) = default;
35  PixelFormat& operator= (const PixelFormat&) = default;
36 };
37 
38 //-----------------------------------------------------------------------------
39 class IOpenGLView
40 {
41 public:
42  virtual void drawOpenGL (const CRect& updateRect) = 0;
43  virtual void reshape () = 0;
44 };
45 
46 //-----------------------------------------------------------------------------
47 class IPlatformOpenGLView : public AtomicReferenceCounted
48 {
49 public:
50 
51  virtual bool init (IOpenGLView* view, PixelFormat* pixelFormat = nullptr) = 0;
52  virtual void remove () = 0;
53 
54  virtual void invalidRect (const CRect& rect) = 0;
55  virtual void viewSizeChanged (const CRect& visibleSize) = 0;
56 
57  virtual bool makeContextCurrent () = 0;
58  virtual bool lockContext () = 0;
59  virtual bool unlockContext () = 0;
60 
61  virtual void swapBuffers () = 0;
62 };
63 
64 } // namespace
65 
66 #endif // VSTGUI_OPENGL_SUPPORT
67 
69 
70 #endif // __iplatformopenglview__
71 
Definition: customcontrols.cpp:8