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 /////////////////////////////////////////////////////////////////////////////
20 #include "myglcanvas.h"
22 #include <wx/glcanvas.h>
27 //---------------------------------------------------------------------------
30 %include my_typemaps.i
44 %pragma(python) code = "import wx"
46 //----------------------------------------------------------------------
49 // Put some wx default wxChar* values into wxStrings.
50 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
51 static const wxString wxPyEmptyString(wxT(""));
54 //---------------------------------------------------------------------------
62 //---------------------------------------------------------------------------
64 class wxGLContext : public wxObject {
66 #ifndef __WXMAC__ // fix this?
67 wxGLContext(bool isRGB, wxGLCanvas *win,
68 const wxPalette& palette = wxNullPalette);
73 void SetColour(const wxString& colour);
77 void SetupPixelFormat();
78 void SetupPalette(const wxPalette& palette);
79 wxPalette CreateDefaultPalette();
80 wxPalette* GetPalette();
83 wxWindow* GetWindow();
86 //---------------------------------------------------------------------------
89 WX_GL_RGBA, // use true color palette
90 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
91 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
92 WX_GL_DOUBLEBUFFER, // use doublebuffer
93 WX_GL_STEREO, // use stereoscopic display
94 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
95 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
96 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
97 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
98 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
99 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
100 WX_GL_STENCIL_SIZE, // bits for stencil buffer
101 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
102 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
103 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
104 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
108 %typemap(python, in) int *attribList (int *temp) {
110 if (PySequence_Check($source)) {
111 int size = PyObject_Length($source);
112 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
113 for (i = 0; i < size; i++) {
114 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
121 %typemap(python, freearg) int *attribList
128 class wxGLCanvas : public wxWindow {
130 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize, long style = 0,
133 const wxString& name = wxPyGLCanvasNameStr,
134 int *attribList = NULL,
135 const wxPalette& palette = wxNullPalette);
137 %name(wxGLCanvasWithContext)
138 wxGLCanvas( wxWindow *parent,
139 const wxGLContext *shared = NULL,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
144 const wxString& name = wxPyGLCanvasNameStr,
145 int *attribList = NULL,
146 const wxPalette& palette = wxNullPalette );
148 // bool Create(wxWindow *parent, wxWindowID id,
149 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
151 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
152 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
155 void SetColour(const wxString& colour);
158 wxGLContext* GetContext();
161 void SetupPixelFormat(int *attribList = NULL);
162 void SetupPalette(const wxPalette& palette);
163 wxPalette CreateDefaultPalette();
164 wxPalette* GetPalette();
169 //---------------------------------------------------------------------------
175 //---------------------------------------------------------------------------
176 //---------------------------------------------------------------------------