Whitespace fixes
[wxWidgets.git] / src / gtk1 / glcanvas.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/glcanvas.cpp
3 // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 17/08/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "glcanvas.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #include "wx/setup.h"
20
21 #if wxUSE_GLCANVAS
22
23 #include "wx/glcanvas.h"
24
25 #include "wx/frame.h"
26 #include "wx/colour.h"
27 #include "wx/module.h"
28 #include "wx/app.h"
29
30 extern "C"
31 {
32 #include "gtk/gtk.h"
33 #include "gdk/gdk.h"
34 #include "gdk/gdkx.h"
35 }
36
37 #include "wx/gtk/win_gtk.h"
38
39 // DLL options compatibility check:
40 #include "wx/build.h"
41 WX_CHECK_BUILD_OPTIONS("wxGL")
42
43
44 //---------------------------------------------------------------------------
45 // static variables
46 //---------------------------------------------------------------------------
47 int wxGLCanvas::m_glxVersion = 0;
48
49 //---------------------------------------------------------------------------
50 // global data
51 //---------------------------------------------------------------------------
52
53 XVisualInfo *g_vi = (XVisualInfo*) NULL;
54 //-----------------------------------------------------------------------------
55 // idle system
56 //-----------------------------------------------------------------------------
57
58 extern void wxapp_install_idle_handler();
59 extern bool g_isIdle;
60
61 //---------------------------------------------------------------------------
62 // wxGLContext
63 //---------------------------------------------------------------------------
64
65 IMPLEMENT_CLASS(wxGLContext,wxObject)
66
67 wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette) )
68 {
69 m_window = win;
70 m_widget = win->m_wxwindow;
71
72 wxGLCanvas *gc = (wxGLCanvas*) win;
73
74 if (wxGLCanvas::GetGLXVersion() >= 13)
75 {
76 // GLX >= 1.3
77 GLXFBConfig *fbc = gc->m_fbc;
78 wxCHECK_RET( fbc, _T("invalid GLXFBConfig for OpenGl") );
79 m_glContext = glXCreateNewContext( GDK_DISPLAY(), fbc[0], GLX_RGBA_TYPE, None, GL_TRUE );
80 }
81 else
82 {
83 // GLX <= 1.2
84 XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
85 wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
86 m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
87 }
88
89 wxCHECK_RET( m_glContext, _T("Couldn't create OpenGl context") );
90 }
91
92 wxGLContext::wxGLContext(
93 bool WXUNUSED(isRGB), wxWindow *win,
94 const wxPalette& WXUNUSED(palette),
95 const wxGLContext *other /* for sharing display lists */
96 )
97 {
98 m_window = win;
99 m_widget = win->m_wxwindow;
100
101 wxGLCanvas *gc = (wxGLCanvas*) win;
102
103 if (wxGLCanvas::GetGLXVersion() >= 13)
104 {
105 // GLX >= 1.3
106 GLXFBConfig *fbc = gc->m_fbc;
107 wxCHECK_RET( fbc, _T("invalid GLXFBConfig for OpenGl") );
108 m_glContext = glXCreateNewContext( GDK_DISPLAY(), fbc[0], GLX_RGBA_TYPE,
109 other ? other->m_glContext : None,
110 GL_TRUE );
111 }
112 else
113 {
114 // GLX <= 1.2
115 XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
116 wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
117 m_glContext = glXCreateContext( GDK_DISPLAY(), vi,
118 other ? other->m_glContext : None,
119 GL_TRUE );
120 }
121
122 if ( !m_glContext )
123 {
124 wxFAIL_MSG( _T("Couldn't create OpenGl context") );
125 }
126 }
127
128 wxGLContext::~wxGLContext()
129 {
130 if (!m_glContext) return;
131
132 if (m_glContext == glXGetCurrentContext())
133 {
134 if (wxGLCanvas::GetGLXVersion() >= 13)
135 // GLX >= 1.3
136 glXMakeContextCurrent( GDK_DISPLAY(), None, None, NULL);
137 else
138 // GLX <= 1.2
139 glXMakeCurrent( GDK_DISPLAY(), None, NULL);
140 }
141
142 glXDestroyContext( GDK_DISPLAY(), m_glContext );
143 }
144
145 void wxGLContext::SwapBuffers()
146 {
147 if (m_glContext)
148 {
149 GdkWindow *window = GTK_PIZZA(m_widget)->bin_window;
150 glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( window ) );
151 }
152 }
153
154 void wxGLContext::SetCurrent()
155 {
156 if (m_glContext)
157 {
158 GdkWindow *window = GTK_PIZZA(m_widget)->bin_window;
159
160 if (wxGLCanvas::GetGLXVersion() >= 13)
161 // GLX >= 1.3
162 glXMakeContextCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window),
163 GDK_WINDOW_XWINDOW(window), m_glContext );
164 else
165 // GLX <= 1.2
166 glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext );
167 }
168 }
169
170 void wxGLContext::SetColour(const wxChar *colour)
171 {
172 wxColour col = wxTheColourDatabase->Find(colour);
173 if (col.Ok())
174 {
175 float r = (float)(col.Red()/256.0);
176 float g = (float)(col.Green()/256.0);
177 float b = (float)(col.Blue()/256.0);
178 glColor3f( r, g, b);
179 }
180 }
181
182 void wxGLContext::SetupPixelFormat()
183 {
184 }
185
186 void wxGLContext::SetupPalette( const wxPalette& WXUNUSED(palette) )
187 {
188 }
189
190 wxPalette wxGLContext::CreateDefaultPalette()
191 {
192 return wxNullPalette;
193 }
194
195 //-----------------------------------------------------------------------------
196 // "realize" from m_wxwindow
197 //-----------------------------------------------------------------------------
198
199 extern "C" {
200 static gint
201 gtk_glwindow_realized_callback( GtkWidget *WXUNUSED(widget), wxGLCanvas *win )
202 {
203 if ( !win->m_glContext )
204 {
205 wxGLContext *share = win->m_sharedContext;
206 if ( !share && win->m_sharedContextOf )
207 share = win->m_sharedContextOf->GetContext();
208
209 win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share );
210 }
211
212 return FALSE;
213 }
214 }
215
216 //-----------------------------------------------------------------------------
217 // "map" from m_wxwindow
218 //-----------------------------------------------------------------------------
219
220 extern "C" {
221 static gint
222 gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
223 {
224 if (win->m_glContext/* && win->m_exposed*/)
225 {
226 wxPaintEvent event( win->GetId() );
227 event.SetEventObject( win );
228 win->GetEventHandler()->ProcessEvent( event );
229
230 win->m_exposed = FALSE;
231 win->GetUpdateRegion().Clear();
232 }
233
234 return FALSE;
235 }
236 }
237
238 //-----------------------------------------------------------------------------
239 // "expose_event" of m_wxwindow
240 //-----------------------------------------------------------------------------
241
242 extern "C" {
243 static void
244 gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win )
245 {
246 if (g_isIdle)
247 wxapp_install_idle_handler();
248
249 win->m_exposed = TRUE;
250
251 win->GetUpdateRegion().Union( gdk_event->area.x,
252 gdk_event->area.y,
253 gdk_event->area.width,
254 gdk_event->area.height );
255 }
256 }
257
258 //-----------------------------------------------------------------------------
259 // "draw" of m_wxwindow
260 //-----------------------------------------------------------------------------
261
262 #ifndef __WXGTK20__
263 extern "C" {
264 static void
265 gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win )
266 {
267 if (g_isIdle)
268 wxapp_install_idle_handler();
269
270 win->m_exposed = TRUE;
271
272 win->GetUpdateRegion().Union( rect->x, rect->y,
273 rect->width, rect->height );
274 }
275 }
276 #endif
277
278 //-----------------------------------------------------------------------------
279 // "size_allocate" of m_wxwindow
280 //-----------------------------------------------------------------------------
281
282 extern "C" {
283 static void
284 gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win )
285 {
286 if (g_isIdle)
287 wxapp_install_idle_handler();
288
289 if (!win->m_hasVMT)
290 return;
291
292 wxSizeEvent event( wxSize(win->m_width,win->m_height), win->GetId() );
293 event.SetEventObject( win );
294 win->GetEventHandler()->ProcessEvent( event );
295 }
296 }
297
298 //---------------------------------------------------------------------------
299 // wxGlCanvas
300 //---------------------------------------------------------------------------
301
302 IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
303
304 BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
305 EVT_SIZE(wxGLCanvas::OnSize)
306 END_EVENT_TABLE()
307
308 wxGLCanvas::wxGLCanvas( wxWindow *parent, wxWindowID id,
309 const wxPoint& pos, const wxSize& size,
310 long style, const wxString& name,
311 int *attribList,
312 const wxPalette& palette )
313 {
314 Create( parent, NULL, NULL, id, pos, size, style, name, attribList, palette );
315 }
316
317 wxGLCanvas::wxGLCanvas( wxWindow *parent,
318 const wxGLContext *shared,
319 wxWindowID id,
320 const wxPoint& pos, const wxSize& size,
321 long style, const wxString& name,
322 int *attribList,
323 const wxPalette& palette )
324 {
325 Create( parent, shared, NULL, id, pos, size, style, name, attribList, palette );
326 }
327
328 wxGLCanvas::wxGLCanvas( wxWindow *parent,
329 const wxGLCanvas *shared,
330 wxWindowID id,
331 const wxPoint& pos, const wxSize& size,
332 long style, const wxString& name,
333 int *attribList,
334 const wxPalette& palette )
335 {
336 Create( parent, NULL, shared, id, pos, size, style, name, attribList, palette );
337 }
338
339 bool wxGLCanvas::Create( wxWindow *parent,
340 const wxGLContext *shared,
341 const wxGLCanvas *shared_context_of,
342 wxWindowID id,
343 const wxPoint& pos, const wxSize& size,
344 long style, const wxString& name,
345 int *attribList,
346 const wxPalette& palette)
347 {
348 m_sharedContext = (wxGLContext*)shared; // const_cast
349 m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast
350 m_glContext = (wxGLContext*) NULL;
351
352 m_exposed = FALSE;
353 m_noExpose = TRUE;
354 m_nativeSizeEvent = TRUE;
355 m_fbc = NULL;
356 m_vi = NULL;
357
358 // to be sure the glx version is known
359 wxGLCanvas::QueryGLXVersion();
360
361 if (wxGLCanvas::GetGLXVersion() >= 13)
362 {
363 // GLX >= 1.3 uses a GLXFBConfig
364 GLXFBConfig * fbc = NULL;
365 if (wxTheApp->m_glFBCInfo != NULL)
366 {
367 fbc = (GLXFBConfig *) wxTheApp->m_glFBCInfo;
368 m_canFreeFBC = FALSE; // owned by wxTheApp - don't free upon destruction
369 }
370 else
371 {
372 fbc = (GLXFBConfig *) wxGLCanvas::ChooseGLFBC(attribList);
373 m_canFreeFBC = TRUE;
374 }
375 m_fbc = fbc; // save for later use
376 wxCHECK_MSG( m_fbc, FALSE, _T("required FBConfig couldn't be found") );
377 }
378
379 XVisualInfo *vi = NULL;
380 if (wxTheApp->m_glVisualInfo != NULL)
381 {
382 vi = (XVisualInfo *)wxTheApp->m_glVisualInfo;
383 m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction
384 }
385 else
386 {
387 if (wxGLCanvas::GetGLXVersion() >= 13)
388 // GLX >= 1.3
389 vi = glXGetVisualFromFBConfig(GDK_DISPLAY(), m_fbc[0]);
390 else
391 // GLX <= 1.2
392 vi = (XVisualInfo *) ChooseGLVisual(attribList);
393
394 m_canFreeVi = TRUE;
395 }
396
397 m_vi = vi; // save for later use
398
399 wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") );
400 GdkVisual *visual = gdkx_visual_get( vi->visualid );
401 GdkColormap *colormap = gdk_colormap_new( visual, TRUE );
402
403 gtk_widget_push_colormap( colormap );
404 gtk_widget_push_visual( visual );
405
406 wxWindow::Create( parent, id, pos, size, style, name );
407
408 m_glWidget = m_wxwindow;
409
410 #ifdef __WXGTK20__
411 gtk_widget_set_double_buffered( m_glWidget, FALSE );
412 #endif
413
414 gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE );
415
416 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize",
417 GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this );
418
419 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map",
420 GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this );
421
422 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
423 GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this );
424
425 #ifndef __WXGTK20__
426 gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
427 GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this );
428 #endif
429
430 gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
431 GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this );
432
433 gtk_widget_pop_visual();
434 gtk_widget_pop_colormap();
435
436 // if our parent window is already visible, we had been realized before we
437 // connected to the "realize" signal and hence our m_glContext hasn't been
438 // initialized yet and we have to do it now
439 if (GTK_WIDGET_REALIZED(m_wxwindow))
440 gtk_glwindow_realized_callback( m_wxwindow, this );
441
442 if (GTK_WIDGET_MAPPED(m_wxwindow))
443 gtk_glwindow_map_callback( m_wxwindow, this );
444
445 return TRUE;
446 }
447
448 wxGLCanvas::~wxGLCanvas()
449 {
450 GLXFBConfig * fbc = (GLXFBConfig *) m_fbc;
451 if (fbc && m_canFreeFBC)
452 XFree( fbc );
453
454 XVisualInfo *vi = (XVisualInfo *) m_vi;
455 if (vi && m_canFreeVi)
456 XFree( vi );
457
458 delete m_glContext;
459 }
460
461 void* wxGLCanvas::ChooseGLVisual(int *attribList)
462 {
463 int data[512];
464 GetGLAttribListFromWX( attribList, data );
465 attribList = (int*) data;
466
467 Display *dpy = GDK_DISPLAY();
468
469 return glXChooseVisual( dpy, DefaultScreen(dpy), attribList );
470 }
471
472 void* wxGLCanvas::ChooseGLFBC(int *attribList)
473 {
474 int data[512];
475 GetGLAttribListFromWX( attribList, data );
476 attribList = (int*) data;
477
478 int returned;
479 return glXChooseFBConfig( GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()),
480 attribList, &returned );
481 }
482
483
484 void wxGLCanvas::GetGLAttribListFromWX(int *wx_attribList, int *gl_attribList )
485 {
486 if (!wx_attribList)
487 {
488 if (wxGLCanvas::GetGLXVersion() >= 13)
489 // leave GLX >= 1.3 choose the default attributes
490 gl_attribList[0] = 0;
491 else
492 {
493 int i = 0;
494 // default settings if attriblist = 0
495 gl_attribList[i++] = GLX_RGBA;
496 gl_attribList[i++] = GLX_DOUBLEBUFFER;
497 gl_attribList[i++] = GLX_DEPTH_SIZE; gl_attribList[i++] = 1;
498 gl_attribList[i++] = GLX_RED_SIZE; gl_attribList[i++] = 1;
499 gl_attribList[i++] = GLX_GREEN_SIZE; gl_attribList[i++] = 1;
500 gl_attribList[i++] = GLX_BLUE_SIZE; gl_attribList[i++] = 1;
501 gl_attribList[i++] = GLX_ALPHA_SIZE; gl_attribList[i++] = 0;
502 gl_attribList[i++] = None;
503 }
504 }
505 else
506 {
507 int arg=0, p=0;
508 while( (wx_attribList[arg]!=0) && (p<510) )
509 {
510 switch( wx_attribList[arg++] )
511 {
512 case WX_GL_RGBA:
513 if (wxGLCanvas::GetGLXVersion() <= 12)
514 // for GLX >= 1.3, GLX_RGBA is useless (setting this flags will crash on most opengl implm)
515 gl_attribList[p++] = GLX_RGBA;
516 break;
517 case WX_GL_BUFFER_SIZE:
518 gl_attribList[p++] = GLX_BUFFER_SIZE;
519 gl_attribList[p++] = wx_attribList[arg++];
520 break;
521 case WX_GL_LEVEL:
522 gl_attribList[p++] = GLX_LEVEL;
523 gl_attribList[p++] = wx_attribList[arg++];
524 break;
525 case WX_GL_DOUBLEBUFFER:
526 if (wxGLCanvas::GetGLXVersion() <= 12)
527 gl_attribList[p++] = GLX_DOUBLEBUFFER;
528 else
529 // for GLX >= 1.3, GLX_DOUBLEBUFFER format is different (1 <=> True)
530 // it seems this flag is useless for some hardware opengl implementation.
531 // but for Mesa 6.2.1, this flag is used so don't ignore it.
532 gl_attribList[p++] = GLX_DOUBLEBUFFER;
533 gl_attribList[p++] = 1;
534 break;
535 case WX_GL_STEREO:
536 gl_attribList[p++] = GLX_STEREO;
537 break;
538 case WX_GL_AUX_BUFFERS:
539 gl_attribList[p++] = GLX_AUX_BUFFERS;
540 gl_attribList[p++] = wx_attribList[arg++];
541 break;
542 case WX_GL_MIN_RED:
543 gl_attribList[p++] = GLX_RED_SIZE;
544 gl_attribList[p++] = wx_attribList[arg++];
545 break;
546 case WX_GL_MIN_GREEN:
547 gl_attribList[p++] = GLX_GREEN_SIZE;
548 gl_attribList[p++] = wx_attribList[arg++];
549 break;
550 case WX_GL_MIN_BLUE:
551 gl_attribList[p++] = GLX_BLUE_SIZE;
552 gl_attribList[p++] = wx_attribList[arg++];
553 break;
554 case WX_GL_MIN_ALPHA:
555 gl_attribList[p++] = GLX_ALPHA_SIZE;
556 gl_attribList[p++] = wx_attribList[arg++];
557 break;
558 case WX_GL_DEPTH_SIZE:
559 gl_attribList[p++] = GLX_DEPTH_SIZE;
560 gl_attribList[p++] = wx_attribList[arg++];
561 break;
562 case WX_GL_STENCIL_SIZE:
563 gl_attribList[p++] = GLX_STENCIL_SIZE;
564 gl_attribList[p++] = wx_attribList[arg++];
565 break;
566 case WX_GL_MIN_ACCUM_RED:
567 gl_attribList[p++] = GLX_ACCUM_RED_SIZE;
568 gl_attribList[p++] = wx_attribList[arg++];
569 break;
570 case WX_GL_MIN_ACCUM_GREEN:
571 gl_attribList[p++] = GLX_ACCUM_GREEN_SIZE;
572 gl_attribList[p++] = wx_attribList[arg++];
573 break;
574 case WX_GL_MIN_ACCUM_BLUE:
575 gl_attribList[p++] = GLX_ACCUM_BLUE_SIZE;
576 gl_attribList[p++] = wx_attribList[arg++];
577 break;
578 case WX_GL_MIN_ACCUM_ALPHA:
579 gl_attribList[p++] = GLX_ACCUM_ALPHA_SIZE;
580 gl_attribList[p++] = wx_attribList[arg++];
581 break;
582 default:
583 break;
584 }
585 }
586
587 gl_attribList[p] = 0;
588 }
589 }
590
591 void wxGLCanvas::QueryGLXVersion()
592 {
593 if (m_glxVersion == 0)
594 {
595 // check the GLX version
596 int glxMajorVer, glxMinorVer;
597 bool ok = glXQueryVersion(GDK_DISPLAY(), &glxMajorVer, &glxMinorVer);
598 wxASSERT_MSG( ok, _T("GLX version not found") );
599 if (!ok)
600 m_glxVersion = 10; // 1.0 by default
601 else
602 m_glxVersion = glxMajorVer*10 + glxMinorVer;
603 }
604 }
605
606 int wxGLCanvas::GetGLXVersion()
607 {
608 wxASSERT_MSG( m_glxVersion>0, _T("GLX version has not been initialized with wxGLCanvas::QueryGLXVersion()") );
609 return m_glxVersion;
610 }
611
612
613 void wxGLCanvas::SwapBuffers()
614 {
615 if (m_glContext)
616 m_glContext->SwapBuffers();
617 }
618
619 void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
620 {
621 }
622
623 void wxGLCanvas::SetCurrent()
624 {
625 if (m_glContext)
626 m_glContext->SetCurrent();
627 }
628
629 void wxGLCanvas::SetColour( const wxChar *colour )
630 {
631 if (m_glContext)
632 m_glContext->SetColour( colour );
633 }
634
635 void wxGLCanvas::OnInternalIdle()
636 {
637 if (m_glContext && m_exposed)
638 {
639 wxPaintEvent event( GetId() );
640 event.SetEventObject( this );
641 GetEventHandler()->ProcessEvent( event );
642
643 m_exposed = FALSE;
644 GetUpdateRegion().Clear();
645 }
646
647 wxWindow::OnInternalIdle();
648 }
649
650
651
652 //---------------------------------------------------------------------------
653 // wxGLApp
654 //---------------------------------------------------------------------------
655
656 IMPLEMENT_CLASS(wxGLApp, wxApp)
657
658 wxGLApp::~wxGLApp()
659 {
660 if (m_glFBCInfo)
661 XFree(m_glFBCInfo);
662 if (m_glVisualInfo)
663 XFree(m_glVisualInfo);
664 }
665
666 bool wxGLApp::InitGLVisual(int *attribList)
667 {
668 wxGLCanvas::QueryGLXVersion();
669
670 if (wxGLCanvas::GetGLXVersion() >= 13)
671 {
672 // GLX >= 1.3
673 if (m_glFBCInfo)
674 XFree(m_glFBCInfo);
675 m_glFBCInfo = wxGLCanvas::ChooseGLFBC(attribList);
676
677 if (m_glFBCInfo)
678 {
679 if (m_glVisualInfo)
680 XFree(m_glVisualInfo);
681 m_glVisualInfo = glXGetVisualFromFBConfig(GDK_DISPLAY(), ((GLXFBConfig *)m_glFBCInfo)[0]);
682 }
683 return (m_glFBCInfo != NULL) && (m_glVisualInfo != NULL);
684 }
685 else
686 {
687 // GLX <= 1.2
688 if (m_glVisualInfo)
689 XFree(m_glVisualInfo);
690 m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList);
691 return m_glVisualInfo != NULL;
692 }
693 }
694
695 #endif
696 // wxUSE_GLCANVAS