]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/glcanvas.h
simplifying native string handling, see #11061
[wxWidgets.git] / include / wx / osx / glcanvas.h
CommitLineData
6762286d
SC
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
421bb018
SC
15#ifdef __WXOSX_IPHONE__
16#import <OpenGLES/ES1/gl.h>
17#import <OpenGLES/ES1/glext.h>
18#else
6762286d 19#include <OpenGL/gl.h>
421bb018 20#endif
6762286d
SC
21
22// low level calls
23
24WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
25WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
26WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext();
b6ccc13c 27WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context);
6762286d
SC
28WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context );
29
30WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList);
31WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat );
32
33class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
34{
35public:
36 wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
37 virtual ~wxGLContext();
38
39 virtual bool SetCurrent(const wxGLCanvas& win) const;
40
41 // Mac-specific
42 WXGLContext GetWXGLContext() const { return m_glContext; }
43
44private:
45 WXGLContext m_glContext;
46
c0c133e1 47 wxDECLARE_NO_COPY_CLASS(wxGLContext);
6762286d
SC
48};
49
50class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
51{
52public:
53 wxGLCanvas(wxWindow *parent,
54 wxWindowID id = wxID_ANY,
55 const int *attribList = NULL,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 long style = 0,
59 const wxString& name = wxGLCanvasName,
60 const wxPalette& palette = wxNullPalette);
61
62 bool Create(wxWindow *parent,
63 wxWindowID id = wxID_ANY,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 long style = 0,
67 const wxString& name = wxGLCanvasName,
68 const int *attribList = NULL,
69 const wxPalette& palette = wxNullPalette);
70
71 virtual ~wxGLCanvas();
72
73 // implement wxGLCanvasBase methods
74 virtual bool SwapBuffers();
75
76
77 // Mac-specific functions
78 // ----------------------
79
80 // return true if multisample extension is supported
81 static bool IsAGLMultiSampleAvailable();
82
83 // return the pixel format used by this window
84 WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; }
85
86 // update the view port of the current context to match this window
87 void SetViewport();
88
89
90 // deprecated methods
91 // ------------------
92
93#if WXWIN_COMPATIBILITY_2_8
94 wxDEPRECATED(
95 wxGLCanvas(wxWindow *parent,
96 wxWindowID id = wxID_ANY,
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize,
99 long style = 0,
100 const wxString& name = wxGLCanvasName,
101 const int *attribList = NULL,
102 const wxPalette& palette = wxNullPalette)
103 );
104
105 wxDEPRECATED(
106 wxGLCanvas(wxWindow *parent,
107 const wxGLContext *shared,
108 wxWindowID id = wxID_ANY,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize,
111 long style = 0,
112 const wxString& name = wxGLCanvasName,
113 const int *attribList = NULL,
114 const wxPalette& palette = wxNullPalette)
115 );
116
117 wxDEPRECATED(
118 wxGLCanvas(wxWindow *parent,
119 const wxGLCanvas *shared,
120 wxWindowID id = wxID_ANY,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize,
123 long style = 0,
124 const wxString& name = wxGLCanvasName,
125 const int *attribList = NULL,
126 const wxPalette& palette = wxNullPalette)
127 );
128#endif // WXWIN_COMPATIBILITY_2_8
129
130 // implementation-only from now on
131
132#if wxOSX_USE_CARBON
133 // Unlike some other platforms, this must get called if you override it,
134 // i.e. don't forget "event.Skip()" in your EVT_SIZE handler
135 void OnSize(wxSizeEvent& event);
136
137 virtual void MacSuperChangedPosition();
138 virtual void MacTopLevelWindowChangedPosition();
139 virtual void MacVisibilityChanged();
140
141 void MacUpdateView();
142
143 GLint GetAglBufferName() const { return m_bufferName; }
144#endif
145
146protected:
147 WXGLPixelFormat m_glFormat;
148
149#if wxOSX_USE_CARBON
150 bool m_macCanvasIsShown,
151 m_needsUpdate;
152 WXGLContext m_dummyContext;
153 GLint m_bufferName;
154#endif
155
156 DECLARE_EVENT_TABLE()
157 DECLARE_CLASS(wxGLCanvas)
158};
159
160#endif // _WX_GLCANVAS_H_