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>
22 static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
23 static const wxString wxPyEmptyString(wxT(""));
26 //---------------------------------------------------------------------------
29 %pythoncode { wx = core }
31 %include _glcanvas_rename.i
33 //---------------------------------------------------------------------------
37 //---------------------------------------------------------------------------
39 class wxGLContext : public wxObject {
42 wxGLContext(bool isRGB, wxGLCanvas *win,
43 const wxPalette& palette = wxNullPalette,
44 const wxGLContext* other = NULL);
47 wxGLContext(bool isRGB, wxGLCanvas *win,
48 const wxPalette& palette = wxNullPalette,
49 const wxGLContext* other = NULL) {
50 AGLPixelFormat fmt; // TODO: How should this be initialized?
51 return new wxGLContext(fmt, win, palette, other);
59 void SetColour(const wxString& colour);
63 void SetupPixelFormat();
64 void SetupPalette(const wxPalette& palette);
65 wxPalette CreateDefaultPalette();
66 wxPalette* GetPalette();
69 wxWindow* GetWindow();
72 //---------------------------------------------------------------------------
75 WX_GL_RGBA, // use true color palette
76 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
77 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
78 WX_GL_DOUBLEBUFFER, // use doublebuffer
79 WX_GL_STEREO, // use stereoscopic display
80 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
81 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
82 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
83 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
84 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
85 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
86 WX_GL_STENCIL_SIZE, // bits for stencil buffer
87 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
88 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
89 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
90 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
94 %typemap(in) int *attribList (int *temp) {
96 if (PySequence_Check($input)) {
97 int size = PyObject_Length($input);
98 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
99 for (i = 0; i < size; i++) {
100 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
107 %typemap(freearg) int *attribList
114 class wxGLCanvas : public wxWindow {
116 %addtofunc wxGLCanvas "self._setOORInfo(self)"
117 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
118 const wxPoint& pos = wxDefaultPosition,
119 const wxSize& size = wxDefaultSize, long style = 0,
120 const wxString& name = wxPyGLCanvasNameStr,
121 int *attribList = NULL,
122 const wxPalette& palette = wxNullPalette);
124 %addtofunc wxGLCanvas "val._setOORInfo(val)"
125 %name(wxGLCanvasWithContext)
126 wxGLCanvas( wxWindow *parent,
127 const wxGLContext *shared = NULL,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize,
132 const wxString& name = wxPyGLCanvasNameStr,
133 int *attribList = NULL,
134 const wxPalette& palette = wxNullPalette );
138 void SetColour(const wxString& colour);
141 wxGLContext* GetContext();
144 void SetupPixelFormat(int *attribList = NULL);
145 void SetupPalette(const wxPalette& palette);
146 wxPalette CreateDefaultPalette();
147 wxPalette* GetPalette();
152 //---------------------------------------------------------------------------
158 //---------------------------------------------------------------------------
159 //---------------------------------------------------------------------------