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 }
30 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
31 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
34 %include _glcanvas_rename.i
36 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
42 class wxGLContext : public wxObject {
45 wxGLContext(bool isRGB, wxGLCanvas *win,
46 const wxPalette& palette = wxNullPalette,
47 const wxGLContext* other = NULL);
50 wxGLContext(bool isRGB, wxGLCanvas *win,
51 const wxPalette& palette = wxNullPalette,
52 const wxGLContext* other = NULL) {
53 AGLPixelFormat fmt; // TODO: How should this be initialized?
54 return new wxGLContext(fmt, win, palette, other);
62 void SetColour(const wxString& colour);
66 void SetupPixelFormat();
67 void SetupPalette(const wxPalette& palette);
68 wxPalette CreateDefaultPalette();
69 wxPalette* GetPalette();
72 wxWindow* GetWindow();
75 //---------------------------------------------------------------------------
78 WX_GL_RGBA, // use true color palette
79 WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
80 WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
81 WX_GL_DOUBLEBUFFER, // use doublebuffer
82 WX_GL_STEREO, // use stereoscopic display
83 WX_GL_AUX_BUFFERS, // number of auxiliary buffers
84 WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
85 WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
86 WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
87 WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
88 WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
89 WX_GL_STENCIL_SIZE, // bits for stencil buffer
90 WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
91 WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
92 WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
93 WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
97 %typemap(in) int *attribList (int *temp) {
99 if (PySequence_Check($input)) {
100 int size = PyObject_Length($input);
101 temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
102 for (i = 0; i < size; i++) {
103 temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
110 %typemap(freearg) int *attribList
117 class wxGLCanvas : public wxWindow {
119 %addtofunc wxGLCanvas "self._setOORInfo(self)"
120 wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize, long style = 0,
123 const wxString& name = wxPyGLCanvasNameStr,
124 int *attribList = NULL,
125 const wxPalette& palette = wxNullPalette);
127 %addtofunc wxGLCanvas "val._setOORInfo(val)"
128 %name(wxGLCanvasWithContext)
129 wxGLCanvas( wxWindow *parent,
130 const wxGLContext *shared = NULL,
132 const wxPoint& pos = wxDefaultPosition,
133 const wxSize& size = wxDefaultSize,
135 const wxString& name = wxPyGLCanvasNameStr,
136 int *attribList = NULL,
137 const wxPalette& palette = wxNullPalette );
141 void SetColour(const wxString& colour);
144 wxGLContext* GetContext();
147 void SetupPixelFormat(int *attribList = NULL);
148 void SetupPalette(const wxPalette& palette);
149 wxPalette CreateDefaultPalette();
150 wxPalette* GetPalette();
155 //---------------------------------------------------------------------------
161 //---------------------------------------------------------------------------
162 //---------------------------------------------------------------------------