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 /////////////////////////////////////////////////////////////////////////////
 
  15 "`GLCanvas` provides an OpenGL Context on a `wx.Window`."
 
  18 %module(package="wx", docstring=DOCSTRING) glcanvas
 
  21 #include "wx/wxPython/wxPython.h"
 
  22 #include "wx/wxPython/pyclasses.h"
 
  24 #include <wx/glcanvas.h>
 
  28 //---------------------------------------------------------------------------
 
  31 %pythoncode { wx = _core }
 
  32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
 
  35 MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
 
  36 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 
  39 %include _glcanvas_rename.i
 
  41 //---------------------------------------------------------------------------
 
  45 //---------------------------------------------------------------------------
 
  47 MustHaveApp(wxGLContext);
 
  49 class wxGLContext : public wxObject {
 
  52     wxGLContext(bool isRGB, wxGLCanvas *win,
 
  53                 const wxPalette& palette = wxNullPalette,
 
  54                 const wxGLContext* other = NULL);
 
  57         wxGLContext(bool isRGB, wxGLCanvas *win,
 
  58                     const wxPalette& palette = wxNullPalette,
 
  59                     const wxGLContext* other = NULL) {
 
  60             AGLPixelFormat fmt;  // TODO: How should this be initialized?
 
  61             return new wxGLContext(fmt, win, palette, other);
 
  69     void SetColour(const wxString& colour);
 
  73     void SetupPixelFormat();
 
  74     void SetupPalette(const wxPalette& palette);
 
  75     wxPalette CreateDefaultPalette();
 
  76     wxPalette* GetPalette();
 
  79     wxWindow* GetWindow();
 
  82 //---------------------------------------------------------------------------
 
  85     WX_GL_RGBA,              // use true color palette
 
  86     WX_GL_BUFFER_SIZE,       // bits for buffer if not WX_GL_RGBA
 
  87     WX_GL_LEVEL,             // 0 for main buffer, >0 for overlay, <0 for underlay
 
  88     WX_GL_DOUBLEBUFFER,      // use doublebuffer
 
  89     WX_GL_STEREO,            // use stereoscopic display
 
  90     WX_GL_AUX_BUFFERS,       // number of auxiliary buffers
 
  91     WX_GL_MIN_RED,           // use red buffer with most bits (> MIN_RED bits)
 
  92     WX_GL_MIN_GREEN,         // use green buffer with most bits (> MIN_GREEN bits)
 
  93     WX_GL_MIN_BLUE,          // use blue buffer with most bits (> MIN_BLUE bits)
 
  94     WX_GL_MIN_ALPHA,         // use blue buffer with most bits (> MIN_ALPHA bits)
 
  95     WX_GL_DEPTH_SIZE,        // bits for Z-buffer (0,16,32)
 
  96     WX_GL_STENCIL_SIZE,      // bits for stencil buffer
 
  97     WX_GL_MIN_ACCUM_RED,     // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
 
  98     WX_GL_MIN_ACCUM_GREEN,   // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
 
  99     WX_GL_MIN_ACCUM_BLUE,    // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
 
 100     WX_GL_MIN_ACCUM_ALPHA    // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
 
 104 %typemap(in) int *attribList (int *temp) {
 
 106     if (PySequence_Check($input)) {
 
 107         int size = PyObject_Length($input);
 
 108         temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
 
 109         for (i = 0; i < size; i++) {
 
 110             temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
 
 117 %typemap(freearg) int *attribList
 
 124 MustHaveApp(wxGLCanvas);
 
 126 class wxGLCanvas : public wxWindow {
 
 128     %pythonAppend wxGLCanvas   "self._setOORInfo(self)"
 
 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     %pythonAppend wxGLCanvas   "val._setOORInfo(val)"
 
 137     %name(GLCanvasWithContext)
 
 138         wxGLCanvas( wxWindow *parent,
 
 139                     const wxGLContext *shared = NULL,
 
 141                     const wxPoint& pos = wxDefaultPosition,
 
 142                     const wxSize& size = wxDefaultSize,
 
 144                     const wxString& name = wxPyGLCanvasNameStr,
 
 145                     int *attribList = NULL,
 
 146                     const wxPalette& palette = wxNullPalette );
 
 150     void SetColour(const wxString& colour);
 
 153     wxGLContext* GetContext();
 
 156     void SetupPixelFormat(int *attribList = NULL);
 
 157     void SetupPalette(const wxPalette& palette);
 
 158     wxPalette CreateDefaultPalette();
 
 159     wxPalette* GetPalette();
 
 164 //---------------------------------------------------------------------------
 
 170 //---------------------------------------------------------------------------
 
 171 //---------------------------------------------------------------------------