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 the pixel format used by this window
71 AGLPixelFormat
GetAGLPixelFormat() const { return m_aglFormat
; }
73 // update the view port of the current context to match this window
80 #if WXWIN_COMPATIBILITY_2_8
82 wxGLCanvas(wxWindow
*parent
,
83 wxWindowID id
= wxID_ANY
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
87 const wxString
& name
= wxGLCanvasName
,
88 const int *attribList
= NULL
,
89 const wxPalette
& palette
= wxNullPalette
)
93 wxGLCanvas(wxWindow
*parent
,
94 const wxGLContext
*shared
,
95 wxWindowID id
= wxID_ANY
,
96 const wxPoint
& pos
= wxDefaultPosition
,
97 const wxSize
& size
= wxDefaultSize
,
99 const wxString
& name
= wxGLCanvasName
,
100 const int *attribList
= NULL
,
101 const wxPalette
& palette
= wxNullPalette
)
105 wxGLCanvas(wxWindow
*parent
,
106 const wxGLCanvas
*shared
,
107 wxWindowID id
= wxID_ANY
,
108 const wxPoint
& pos
= wxDefaultPosition
,
109 const wxSize
& size
= wxDefaultSize
,
111 const wxString
& name
= wxGLCanvasName
,
112 const int *attribList
= NULL
,
113 const wxPalette
& palette
= wxNullPalette
)
115 #endif // WXWIN_COMPATIBILITY_2_8
117 // implementation-only from now on
119 // Unlike some other platforms, this must get called if you override it,
120 // i.e. don't forget "event.Skip()" in your EVT_SIZE handler
121 void OnSize(wxSizeEvent
& event
);
123 virtual void MacSuperChangedPosition();
124 virtual void MacTopLevelWindowChangedPosition();
125 virtual void MacVisibilityChanged();
127 void MacUpdateView();
130 AGLPixelFormat m_aglFormat
;
132 bool m_macCanvasIsShown
,
135 DECLARE_EVENT_TABLE()
136 DECLARE_CLASS(wxGLCanvas
)
139 #endif // _WX_GLCANVAS_H_