]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/glcanvas.cpp
2689a7af088c06b9cdc6329b197d50dba16747c6
   1 /////////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/x11/glcanvas.cpp 
   3 // Purpose:     wxGLCanvas, for using OpenGL with wxWidgets 
   4 //              Uses the GLX extension. 
   5 // Author:      Julian Smart and Wolfram Gloger 
   6 // Modified by: Vadim Zeitlin to update to new API 
   9 // Copyright:   (c) Julian Smart, Wolfram Gloger 
  10 // Licence:     wxWindows licence 
  11 /////////////////////////////////////////////////////////////////////////////// 
  13 // TODO: merge this with wxGTK version in some src/unix/glcanvasx11.cpp 
  15 // ============================================================================ 
  17 // ============================================================================ 
  19 // ---------------------------------------------------------------------------- 
  21 // ---------------------------------------------------------------------------- 
  23 // for compilers that support precompilation, includes "wx.h". 
  24 #include "wx/wxprec.h" 
  26 #if defined(__BORLANDC__) 
  32 #include "wx/glcanvas.h" 
  39 // ============================================================================ 
  41 // ============================================================================ 
  43 IMPLEMENT_CLASS(wxGLCanvas
, wxWindow
) 
  45 wxGLCanvas::wxGLCanvas(wxWindow 
*parent
, 
  47                        const int *attribList
, 
  52                        const wxPalette
& palette
) 
  54     Create(parent
, id
, pos
, size
, style
, name
, attribList
, palette
); 
  57 bool wxGLCanvas::Create(wxWindow 
*parent
, 
  63                         const int *attribList
, 
  64                         const wxPalette
& palette
) 
  66     if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) ) 
  69     if ( !InitVisual(attribList
) ) 
  75 Window 
wxGLCanvas::GetXWindow() const 
  81         GetClientAreaWindow(); 
  85 int wxGLCanvas::GetColourIndex(const wxColour
& col_
) 
  87     wxColour
& col 
= const_cast<wxColour
&>(col_
); 
  90     col
.AllocColour(GetXDisplay()); 
  92     col
.CalcPixel(wxTheApp
->GetMainColormap(wxGetDisplay())); 
  95     return col
.GetPixel(); 
  98 #endif // wxUSE_GLCANVAS