1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the OpenGL wxWindows classes
7 // Created: 15-Mar-1999
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
15 "`GLCanvas` provides an OpenGL Context on a `wx.Window`."
17 %module(docstring=DOCSTRING) glcanvas
20 #include "wx/wxPython/wxPython.h"
21 #include "wx/wxPython/pyclasses.h"
23 #include <wx/glcanvas.h>
27 //---------------------------------------------------------------------------
30 %pythoncode { wx = _core }
31 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
34 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
35 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
38 %include _glcanvas_rename.i
40 //---------------------------------------------------------------------------
44 //---------------------------------------------------------------------------
46 MustHaveApp(wxGLContext);
48 class wxGLContext : public wxObject {
51 wxGLContext(bool isRGB, wxGLCanvas *win,
52 const wxPalette& palette = wxNullPalette,
53 const wxGLContext* other = NULL);
56 wxGLContext(bool isRGB, wxGLCanvas *win,
57 const wxPalette& palette = wxNullPalette,
58 const wxGLContext* other = NULL) {
59 AGLPixelFormat fmt; // TODO: How should this be initialized?
60 return new wxGLContext(fmt, win, palette, other);
68 void SetColour(const wxString& colour);
72 void SetupPixelFormat();
73 void SetupPalette(const wxPalette& palette);
74 wxPalette CreateDefaultPalette();
75 wxPalette* GetPalette();
78 wxWindow* GetWindow();
81 //---------------------------------------------------------------------------
84 WX_GL_RGBA, // use true color palette
85 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
86 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
87 WX_GL_DOUBLEBUFFER, // use doublebuffer
88 WX_GL_STEREO, // use stereoscopic display
89 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
90 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
91 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
92 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
93 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
94 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
95 WX_GL_STENCIL_SIZE, // bits for stencil buffer
96 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
97 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
98 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
99 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
103 %typemap(in) int *attribList (int *temp) {
105 if (PySequence_Check($input)) {
106 int size = PyObject_Length($input);
107 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
108 for (i = 0; i < size; i++) {
109 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
116 %typemap(freearg) int *attribList
123 MustHaveApp(wxGLCanvas);
125 class wxGLCanvas : public wxWindow {
127 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
128 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize, long style = 0,
131 const wxString& name = wxPyGLCanvasNameStr,
132 int *attribList = NULL,
133 const wxPalette& palette = wxNullPalette);
135 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
136 %name(GLCanvasWithContext)
137 wxGLCanvas( wxWindow *parent,
138 const wxGLContext *shared = NULL,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
143 const wxString& name = wxPyGLCanvasNameStr,
144 int *attribList = NULL,
145 const wxPalette& palette = wxNullPalette );
149 void SetColour(const wxString& colour);
152 wxGLContext* GetContext();
155 void SetupPixelFormat(int *attribList = NULL);
156 void SetupPalette(const wxPalette& palette);
157 wxPalette CreateDefaultPalette();
158 wxPalette* GetPalette();
163 //---------------------------------------------------------------------------
169 //---------------------------------------------------------------------------
170 //---------------------------------------------------------------------------