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 /////////////////////////////////////////////////////////////////////////////
19 #include "myglcanvas.h"
21 #include <wx/glcanvas.h>
26 //---------------------------------------------------------------------------
29 %include my_typemaps.i
43 %pragma(python) code = "import wx"
45 //----------------------------------------------------------------------
48 // Put some wx default wxChar* values into wxStrings.
49 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
50 static const wxString wxPyEmptyString(wxT(""));
53 //---------------------------------------------------------------------------
61 //---------------------------------------------------------------------------
63 class wxGLContext : public wxObject {
65 #ifndef __WXMAC__ // fix this?
66 wxGLContext(bool isRGB, wxGLCanvas *win,
67 const wxPalette& palette = wxNullPalette);
72 void SetColour(const char *colour);
76 void SetupPixelFormat();
77 void SetupPalette(const wxPalette& palette);
78 wxPalette CreateDefaultPalette();
79 wxPalette* GetPalette();
82 wxWindow* GetWindow();
85 //---------------------------------------------------------------------------
88 WX_GL_RGBA, // use true color palette
89 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
90 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
91 WX_GL_DOUBLEBUFFER, // use doublebuffer
92 WX_GL_STEREO, // use stereoscopic display
93 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
94 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
95 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
96 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
97 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
98 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
99 WX_GL_STENCIL_SIZE, // bits for stencil buffer
100 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
101 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
102 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
103 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
107 %typemap(python, in) int *attribList (int *temp) {
109 if (PySequence_Check($source)) {
110 int size = PyObject_Length($source);
111 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
112 for (i = 0; i < size; i++) {
113 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
120 %typemap(python, freearg) int *attribList
127 class wxGLCanvas : public wxWindow {
129 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize, long style = 0,
132 const wxString& name = wxPyGLCanvasNameStr,
133 int *attribList = NULL,
134 const wxPalette& palette = wxNullPalette);
136 %name(wxGLCanvasWithContext)
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 );
147 // bool Create(wxWindow *parent, wxWindowID id,
148 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
150 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
151 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
154 void SetColour(const char *colour);
157 wxGLContext* GetContext();
160 void SetupPixelFormat(int *attribList = NULL);
161 void SetupPalette(const wxPalette& palette);
162 wxPalette CreateDefaultPalette();
163 wxPalette* GetPalette();
168 //---------------------------------------------------------------------------
172 wxClassInfo::CleanUpClasses();
173 wxClassInfo::InitializeClasses();
177 //---------------------------------------------------------------------------
178 //---------------------------------------------------------------------------