]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/classic/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_
19 #include "wx/palette.h"
20 #include "wx/scrolwin.h"
24 # include <OpenGL/gl.h>
31 class WXDLLEXPORT wxGLCanvas
; /* forward reference */
33 class WXDLLEXPORT wxGLContext
: public wxObject
36 wxGLContext(AGLPixelFormat fmt
, wxGLCanvas
*win
,
37 const wxPalette
& WXUNUSED(palette
),
38 const wxGLContext
*other
/* for sharing display lists */
40 virtual ~wxGLContext();
43 void Update(); // must be called after window drag/grows/zoom or clut change
44 void SetColour(const wxChar
*colour
);
48 inline wxWindow
* GetWindow() const { return m_window
; }
49 inline AGLDrawable
GetDrawable() const { return m_drawable
; }
52 AGLContext m_glContext
;
53 AGLDrawable m_drawable
;
57 class WXDLLEXPORT wxGLCanvas
: public wxWindow
59 DECLARE_CLASS(wxGLCanvas
)
61 wxGLCanvas(wxWindow
*parent
, wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
62 const wxSize
& size
= wxDefaultSize
, long style
= 0,
63 const wxString
& name
= wxT("GLCanvas") , int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
64 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
,
65 wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
66 const wxSize
& size
= wxDefaultSize
, long style
= 0, const wxString
& name
= wxT("GLCanvas"),
67 int *attribList
= (int*) NULL
, const wxPalette
& palette
= wxNullPalette
);
69 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
, wxWindowID id
= wxID_ANY
,
70 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0,
71 const wxString
& name
= wxT("GLCanvas"), int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
73 virtual ~wxGLCanvas();
75 bool Create(wxWindow
*parent
, const wxGLContext
*shared
, wxWindowID id
,
76 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
77 int *attribList
, const wxPalette
& palette
);
80 void SetColour(const wxChar
*colour
);
84 virtual bool Show(bool show
= true) ;
86 // Unlike some other platforms, this must get called if you override it.
87 // It sets the viewport correctly and update the context.
88 // You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
89 void OnSize(wxSizeEvent
& event
);
91 virtual void MacSuperChangedPosition() ;
92 virtual void MacTopLevelWindowChangedPosition() ;
93 virtual void MacSuperShown( bool show
) ;
95 void MacUpdateView() ;
97 inline wxGLContext
* GetContext() const { return m_glContext
; }
100 wxGLContext
* m_glContext
;
101 bool m_macCanvasIsShown
;
102 DECLARE_EVENT_TABLE()
105 #endif // wxUSE_GLCANVAS
106 #endif // _WX_GLCANVAS_H_