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 #ifdef __WXMAC__ // avoid a bug in Carbon headers
24 #include "myglcanvas.h"
26 #include <wx/glcanvas.h>
31 //---------------------------------------------------------------------------
34 %include my_typemaps.i
48 %pragma(python) code = "import wx"
50 //----------------------------------------------------------------------
53 // Put some wx default wxChar* values into wxStrings.
54 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
55 static const wxString wxPyEmptyString(wxT(""));
58 //---------------------------------------------------------------------------
66 //---------------------------------------------------------------------------
68 class wxGLContext : public wxObject {
70 #ifndef __WXMAC__ // fix this?
71 wxGLContext(bool isRGB, wxGLCanvas *win,
72 const wxPalette& palette = wxNullPalette);
77 void SetColour(const wxString& colour);
81 void SetupPixelFormat();
82 void SetupPalette(const wxPalette& palette);
83 wxPalette CreateDefaultPalette();
84 wxPalette* GetPalette();
87 wxWindow* GetWindow();
90 //---------------------------------------------------------------------------
93 WX_GL_RGBA, // use true color palette
94 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
95 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
96 WX_GL_DOUBLEBUFFER, // use doublebuffer
97 WX_GL_STEREO, // use stereoscopic display
98 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
99 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
100 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
101 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
102 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
103 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
104 WX_GL_STENCIL_SIZE, // bits for stencil buffer
105 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
106 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
107 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
108 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
112 %typemap(python, in) int *attribList (int *temp) {
114 if (PySequence_Check($source)) {
115 int size = PyObject_Length($source);
116 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
117 for (i = 0; i < size; i++) {
118 temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
125 %typemap(python, freearg) int *attribList
132 class wxGLCanvas : public wxWindow {
134 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
135 const wxPoint& pos = wxDefaultPosition,
136 const wxSize& size = wxDefaultSize, long style = 0,
137 const wxString& name = wxPyGLCanvasNameStr,
138 int *attribList = NULL,
139 const wxPalette& palette = wxNullPalette);
141 %name(wxGLCanvasWithContext)
142 wxGLCanvas( wxWindow *parent,
143 const wxGLContext *shared = NULL,
145 const wxPoint& pos = wxDefaultPosition,
146 const wxSize& size = wxDefaultSize,
148 const wxString& name = wxPyGLCanvasNameStr,
149 int *attribList = NULL,
150 const wxPalette& palette = wxNullPalette );
152 // bool Create(wxWindow *parent, wxWindowID id,
153 // const wxPoint& pos, const wxSize& size, long style, const wxString& name);
155 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
156 %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
159 void SetColour(const wxString& colour);
162 wxGLContext* GetContext();
165 void SetupPixelFormat(int *attribList = NULL);
166 void SetupPalette(const wxPalette& palette);
167 wxPalette CreateDefaultPalette();
168 wxPalette* GetPalette();
173 //---------------------------------------------------------------------------
179 //---------------------------------------------------------------------------
180 //---------------------------------------------------------------------------