-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
-//---------------------------------------------------------------------------
-// wxGLContext
-//---------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGLContext,wxObject)
-
-wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette) )
-{
- m_window = win;
- m_widget = win->m_wxwindow;
-
- wxGLCanvas *gc = (wxGLCanvas*) win;
- XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
-
- wxCHECK_RET( vi, "invalid visual for OpenGl" );
-
- m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
-
- wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" );
-}
-
-wxGLContext::wxGLContext(
- bool WXUNUSED(isRGB), wxWindow *win,
- const wxPalette& WXUNUSED(palette),
- const wxGLContext *other /* for sharing display lists */
-)
-{
- m_window = win;
- m_widget = win->m_wxwindow;
-
- wxGLCanvas *gc = (wxGLCanvas*) win;
- XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
-
- wxCHECK_RET( vi, "invalid visual for OpenGl" );
-
- if( other != 0 )
- m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE );
- else
- m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
-
- wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" );
-}
-
-wxGLContext::~wxGLContext()
-{
- if (!m_glContext) return;
-
- if (m_glContext == glXGetCurrentContext())
- {
- glXMakeCurrent( GDK_DISPLAY(), None, NULL);
- }
-
- glXDestroyContext( GDK_DISPLAY(), m_glContext );
-}
-
-void wxGLContext::SwapBuffers()
-{
- if (m_glContext)
- {
- GdkWindow *window = GTK_PIZZA(m_widget)->bin_window;
- glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( window ) );
- }
-}
-
-void wxGLContext::SetCurrent()
-{
- if (m_glContext)
- {
- GdkWindow *window = GTK_PIZZA(m_widget)->bin_window;
- glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext );
- }
-}
-
-void wxGLContext::SetColour(const char *colour)
-{
- float r = 0.0;
- float g = 0.0;
- float b = 0.0;
- wxColour *col = wxTheColourDatabase->FindColour(colour);
- if (col)
- {
- r = (float)(col->Red()/256.0);
- g = (float)(col->Green()/256.0);
- b = (float)(col->Blue()/256.0);
- glColor3f( r, g, b);
- }
-}
-
-void wxGLContext::SetupPixelFormat()
-{
-}
-
-void wxGLContext::SetupPalette( const wxPalette& WXUNUSED(palette) )
-{
-}
-
-wxPalette wxGLContext::CreateDefaultPalette()
-{
- return wxNullPalette;
-}
-
-//-----------------------------------------------------------------------------
-// "realize" from m_wxwindow