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`."
18 %module(package="wx", docstring=DOCSTRING) glcanvas
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
24 #include <wx/glcanvas.h>
28 //---------------------------------------------------------------------------
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
35 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
36 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
38 //---------------------------------------------------------------------------
42 //---------------------------------------------------------------------------
44 MustHaveApp(wxGLContext);
46 class wxGLContext : public wxObject {
49 wxGLContext(bool isRGB, wxGLCanvas *win,
50 const wxPalette& palette = wxNullPalette,
51 const wxGLContext* other = NULL);
54 wxGLContext(bool isRGB, wxGLCanvas *win,
55 const wxPalette& palette = wxNullPalette,
56 const wxGLContext* other = NULL) {
57 AGLPixelFormat fmt; // TODO: How should this be initialized?
58 return new wxGLContext(fmt, win, palette, other);
66 void SetColour(const wxString& colour);
70 void SetupPixelFormat();
71 void SetupPalette(const wxPalette& palette);
72 wxPalette CreateDefaultPalette();
73 wxPalette* GetPalette();
76 wxWindow* GetWindow();
79 //---------------------------------------------------------------------------
82 WX_GL_RGBA, // use true color palette
83 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
84 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
85 WX_GL_DOUBLEBUFFER, // use doublebuffer
86 WX_GL_STEREO, // use stereoscopic display
87 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
88 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
89 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
90 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
91 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
92 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
93 WX_GL_STENCIL_SIZE, // bits for stencil buffer
94 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
95 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
96 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
97 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
101 %typemap(in) int *attribList (int *temp) {
103 if (PySequence_Check($input)) {
104 int size = PyObject_Length($input);
105 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
106 for (i = 0; i < size; i++) {
107 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
114 %typemap(freearg) int *attribList
121 MustHaveApp(wxGLCanvas);
123 class wxGLCanvas : public wxWindow {
125 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
126 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
127 const wxPoint& pos = wxDefaultPosition,
128 const wxSize& size = wxDefaultSize, long style = 0,
129 const wxString& name = wxPyGLCanvasNameStr,
130 int *attribList = NULL,
131 const wxPalette& palette = wxNullPalette);
133 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
134 %RenameCtor(GLCanvasWithContext,
135 wxGLCanvas( wxWindow *parent,
136 const wxGLContext *shared = NULL,
138 const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize,
141 const wxString& name = wxPyGLCanvasNameStr,
142 int *attribList = NULL,
143 const wxPalette& palette = wxNullPalette ));
147 void SetColour(const wxString& colour);
150 wxGLContext* GetContext();
153 void SetupPixelFormat(int *attribList = NULL);
154 void SetupPalette(const wxPalette& palette);
155 wxPalette CreateDefaultPalette();
156 wxPalette* GetPalette();
161 //---------------------------------------------------------------------------
167 //---------------------------------------------------------------------------
168 //---------------------------------------------------------------------------