]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/glcanvas.h
added multisampling (anti-aliasing) support to wxGLCanvas (#9145)
[wxWidgets.git] / include / wx / mac / carbon / glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
14
15 #ifdef __DARWIN__
16 # include <OpenGL/gl.h>
17 # include <AGL/agl.h>
18 #else
19 # include <gl.h>
20 # include <agl.h>
21 #endif
22
23 class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
24 {
25 public:
26 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
27 virtual ~wxGLContext();
28
29 virtual bool SetCurrent(const wxGLCanvas& win) const;
30
31 // Mac-specific
32 AGLContext GetAGLContext() const { return m_aglContext; }
33
34 private:
35 AGLContext m_aglContext;
36
37 DECLARE_NO_COPY_CLASS(wxGLContext)
38 };
39
40 class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
41 {
42 public:
43 wxGLCanvas(wxWindow *parent,
44 wxWindowID id = wxID_ANY,
45 const int *attribList = NULL,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = 0,
49 const wxString& name = wxGLCanvasName,
50 const wxPalette& palette = wxNullPalette);
51
52 bool Create(wxWindow *parent,
53 wxWindowID id = wxID_ANY,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = 0,
57 const wxString& name = wxGLCanvasName,
58 const int *attribList = NULL,
59 const wxPalette& palette = wxNullPalette);
60
61 virtual ~wxGLCanvas();
62
63 // implement wxGLCanvasBase methods
64 virtual bool SwapBuffers();
65
66
67 // Mac-specific functions
68 // ----------------------
69
70 // return true if multisample extension is supported
71 static bool IsAGLMultiSampleAvailable();
72
73 // return the pixel format used by this window
74 AGLPixelFormat GetAGLPixelFormat() const { return m_aglFormat; }
75
76 // update the view port of the current context to match this window
77 void SetViewport();
78
79
80 // deprecated methods
81 // ------------------
82
83 #if WXWIN_COMPATIBILITY_2_8
84 wxDEPRECATED(
85 wxGLCanvas(wxWindow *parent,
86 wxWindowID id = wxID_ANY,
87 const wxPoint& pos = wxDefaultPosition,
88 const wxSize& size = wxDefaultSize,
89 long style = 0,
90 const wxString& name = wxGLCanvasName,
91 const int *attribList = NULL,
92 const wxPalette& palette = wxNullPalette)
93 );
94
95 wxDEPRECATED(
96 wxGLCanvas(wxWindow *parent,
97 const wxGLContext *shared,
98 wxWindowID id = wxID_ANY,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = 0,
102 const wxString& name = wxGLCanvasName,
103 const int *attribList = NULL,
104 const wxPalette& palette = wxNullPalette)
105 );
106
107 wxDEPRECATED(
108 wxGLCanvas(wxWindow *parent,
109 const wxGLCanvas *shared,
110 wxWindowID id = wxID_ANY,
111 const wxPoint& pos = wxDefaultPosition,
112 const wxSize& size = wxDefaultSize,
113 long style = 0,
114 const wxString& name = wxGLCanvasName,
115 const int *attribList = NULL,
116 const wxPalette& palette = wxNullPalette)
117 );
118 #endif // WXWIN_COMPATIBILITY_2_8
119
120 // implementation-only from now on
121
122 // Unlike some other platforms, this must get called if you override it,
123 // i.e. don't forget "event.Skip()" in your EVT_SIZE handler
124 void OnSize(wxSizeEvent& event);
125
126 virtual void MacSuperChangedPosition();
127 virtual void MacTopLevelWindowChangedPosition();
128 virtual void MacVisibilityChanged();
129
130 void MacUpdateView();
131
132 protected:
133 AGLPixelFormat m_aglFormat;
134
135 bool m_macCanvasIsShown,
136 m_needsUpdate;
137
138 DECLARE_EVENT_TABLE()
139 DECLARE_CLASS(wxGLCanvas)
140 };
141
142 #endif // _WX_GLCANVAS_H_