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 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/wxPython/wxPython.h"
18 #include "wx/wxPython/pyclasses.h"
20 #include <wx/glcanvas.h>
24 //---------------------------------------------------------------------------
27 %pythoncode { wx = _core }
28 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
31 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
32 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
35 %include _glcanvas_rename.i
37 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
43 class wxGLContext : public wxObject {
46 wxGLContext(bool isRGB, wxGLCanvas *win,
47 const wxPalette& palette = wxNullPalette,
48 const wxGLContext* other = NULL);
51 wxGLContext(bool isRGB, wxGLCanvas *win,
52 const wxPalette& palette = wxNullPalette,
53 const wxGLContext* other = NULL) {
54 AGLPixelFormat fmt; // TODO: How should this be initialized?
55 return new wxGLContext(fmt, win, palette, other);
63 void SetColour(const wxString& colour);
67 void SetupPixelFormat();
68 void SetupPalette(const wxPalette& palette);
69 wxPalette CreateDefaultPalette();
70 wxPalette* GetPalette();
73 wxWindow* GetWindow();
76 //---------------------------------------------------------------------------
79 WX_GL_RGBA, // use true color palette
80 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
81 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
82 WX_GL_DOUBLEBUFFER, // use doublebuffer
83 WX_GL_STEREO, // use stereoscopic display
84 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
85 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
86 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
87 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
88 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
89 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
90 WX_GL_STENCIL_SIZE, // bits for stencil buffer
91 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
92 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
93 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
94 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
98 %typemap(in) int *attribList (int *temp) {
100 if (PySequence_Check($input)) {
101 int size = PyObject_Length($input);
102 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
103 for (i = 0; i < size; i++) {
104 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
111 %typemap(freearg) int *attribList
118 class wxGLCanvas : public wxWindow {
120 %pythonAppend wxGLCanvas "self._setOORInfo(self)"
121 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
122 const wxPoint& pos = wxDefaultPosition,
123 const wxSize& size = wxDefaultSize, long style = 0,
124 const wxString& name = wxPyGLCanvasNameStr,
125 int *attribList = NULL,
126 const wxPalette& palette = wxNullPalette);
128 %pythonAppend wxGLCanvas "val._setOORInfo(val)"
129 %name(GLCanvasWithContext)
130 wxGLCanvas( wxWindow *parent,
131 const wxGLContext *shared = NULL,
133 const wxPoint& pos = wxDefaultPosition,
134 const wxSize& size = wxDefaultSize,
136 const wxString& name = wxPyGLCanvasNameStr,
137 int *attribList = NULL,
138 const wxPalette& palette = wxNullPalette );
142 void SetColour(const wxString& colour);
145 wxGLContext* GetContext();
148 void SetupPixelFormat(int *attribList = NULL);
149 void SetupPalette(const wxPalette& palette);
150 wxPalette CreateDefaultPalette();
151 wxPalette* GetPalette();
156 //---------------------------------------------------------------------------
162 //---------------------------------------------------------------------------
163 //---------------------------------------------------------------------------