]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/glcanvas.cpp
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
8 // Copyright: (c) Julian Smart, Wolfram Gloger
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // TODO: merge this with wxGTK version in some src/unix/glcanvasx11.cpp
14 // ============================================================================
16 // ============================================================================
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 // for compilers that support precompilation, includes "wx.h".
23 #include "wx/wxprec.h"
25 #if defined(__BORLANDC__)
31 #include "wx/glcanvas.h"
38 // ============================================================================
40 // ============================================================================
42 IMPLEMENT_CLASS(wxGLCanvas
, wxWindow
)
44 wxGLCanvas::wxGLCanvas(wxWindow
*parent
,
46 const int *attribList
,
51 const wxPalette
& palette
)
53 Create(parent
, id
, pos
, size
, style
, name
, attribList
, palette
);
56 bool wxGLCanvas::Create(wxWindow
*parent
,
62 const int *attribList
,
63 const wxPalette
& WXUNUSED(palette
))
65 if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) )
68 if ( !InitVisual(attribList
) )
74 Window
wxGLCanvas::GetXWindow() const
80 GetClientAreaWindow();
84 int wxGLCanvas::GetColourIndex(const wxColour
& col_
)
86 wxColour
& col
= const_cast<wxColour
&>(col_
);
89 col
.AllocColour(GetXDisplay());
91 col
.CalcPixel(wxTheApp
->GetMainColormap(wxGetDisplay()));
94 return col
.GetPixel();
97 #endif // wxUSE_GLCANVAS