1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
16 # include <OpenGL/gl.h>
23 class WXDLLIMPEXP_GL wxGLContext
: public wxGLContextBase
26 wxGLContext(wxGLCanvas
*win
, const wxGLContext
*other
= NULL
);
27 virtual ~wxGLContext();
29 virtual bool SetCurrent(const wxGLCanvas
& win
) const;
32 AGLContext
GetAGLContext() const { return m_aglContext
; }
35 AGLContext m_aglContext
;
37 DECLARE_NO_COPY_CLASS(wxGLContext
)
40 class WXDLLIMPEXP_GL wxGLCanvas
: public wxGLCanvasBase
43 wxGLCanvas(wxWindow
*parent
,
44 wxWindowID id
= wxID_ANY
,
45 const int *attribList
= NULL
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
49 const wxString
& name
= wxGLCanvasName
,
50 const wxPalette
& palette
= wxNullPalette
);
52 bool Create(wxWindow
*parent
,
53 wxWindowID id
= wxID_ANY
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
57 const wxString
& name
= wxGLCanvasName
,
58 const int *attribList
= NULL
,
59 const wxPalette
& palette
= wxNullPalette
);
61 virtual ~wxGLCanvas();
63 // implement wxGLCanvasBase methods
64 virtual bool SwapBuffers();
67 // Mac-specific functions
68 // ----------------------
70 // return true if multisample extension is supported
71 static bool IsAGLMultiSampleAvailable();
73 // return the pixel format used by this window
74 AGLPixelFormat
GetAGLPixelFormat() const { return m_aglFormat
; }
76 // update the view port of the current context to match this window
83 #if WXWIN_COMPATIBILITY_2_8
85 wxGLCanvas(wxWindow
*parent
,
86 wxWindowID id
= wxID_ANY
,
87 const wxPoint
& pos
= wxDefaultPosition
,
88 const wxSize
& size
= wxDefaultSize
,
90 const wxString
& name
= wxGLCanvasName
,
91 const int *attribList
= NULL
,
92 const wxPalette
& palette
= wxNullPalette
)
96 wxGLCanvas(wxWindow
*parent
,
97 const wxGLContext
*shared
,
98 wxWindowID id
= wxID_ANY
,
99 const wxPoint
& pos
= wxDefaultPosition
,
100 const wxSize
& size
= wxDefaultSize
,
102 const wxString
& name
= wxGLCanvasName
,
103 const int *attribList
= NULL
,
104 const wxPalette
& palette
= wxNullPalette
)
108 wxGLCanvas(wxWindow
*parent
,
109 const wxGLCanvas
*shared
,
110 wxWindowID id
= wxID_ANY
,
111 const wxPoint
& pos
= wxDefaultPosition
,
112 const wxSize
& size
= wxDefaultSize
,
114 const wxString
& name
= wxGLCanvasName
,
115 const int *attribList
= NULL
,
116 const wxPalette
& palette
= wxNullPalette
)
118 #endif // WXWIN_COMPATIBILITY_2_8
120 // implementation-only from now on
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
);
126 virtual void MacSuperChangedPosition();
127 virtual void MacTopLevelWindowChangedPosition();
128 virtual void MacVisibilityChanged();
130 void MacUpdateView();
133 AGLPixelFormat m_aglFormat
;
135 bool m_macCanvasIsShown
,
138 DECLARE_EVENT_TABLE()
139 DECLARE_CLASS(wxGLCanvas
)
142 #endif // _WX_GLCANVAS_H_