1 GLCanvas class for wxWindows 1.66 using the GLX protocol extension
2 ==================================================================
4 I have just uploaded a file 'wx166glx.tar.gz' to the wxWindows
5 incoming directory. It contains an implementation of a GLCanvas class
6 (interfacing an ordinary wxCanvas with OpenGL calls) for X11 (I tested
7 with Motif, maybe it works with XView as well). I tried to imitate
8 what Julian did in 'wxmesa1.zip' for MS Windows in conjunction with
11 Of the several possibilities to use OpenGL under X11, I chose the GLX
12 server extension, because it is the most efficient method on machines
13 with graphics hardware support (I expect wxWindows/OpenGL applications
14 to _fly_ on my Indy :-). However, you don't need a 'real' OpenGL
15 implementation to use GLCanvas -- the free Mesa library has a
16 simulated GLX interface built-in. Just link in libMesaGLU and
17 libMesaGL along with libwx_motif and everything should work fine.
21 Untar wx166glx.tar.gz from your main wxWindows directory (i.e. where
22 the `include' and `src' subdirectories are). Then apply the small
23 patch file which has appeared in the `glx' subdirectory:
25 % patch -p0 < glx/wx166-glx.diff
27 Recompile the wx_motif library in the standard way. The inclusion of
28 the GLCanvas class in libwx_motif is protected with a new 'USE_GLX'
29 flag in wx_setup.h, so it could maybe be included in a future
30 wxWindows release (with USE_GLX turned off by default).
32 Two new samples (bounce and prim) are included. I adapted them from
33 wxmesa1.zip -- they should compile under both MS Windows (with wxMesa)
34 and X11. The makefile.unx's are set up for the Mesa libraries; if you
35 have original libGLU/libGL's just change the GLLIBS = ... line.
39 One more or less serious problem remains: the visual generated by the
40 GLCanvas class must match the visual of wxCanvas.xwindow (which
41 currently is always the screen's default visual). The end result is
42 that you will get a nice RGB mode for OpenGL only if your display's
43 default visual is TrueColor or DirectColor (the XFree86 S3 servers for
44 PCs with the '-bpp 16/32' option are examples). I'm contemplating a
45 solution where the wxCanvas drawingarea widget is destroyed and then
46 re-created from within the GLCanvas constructor. I would welcome
47 suggestions on this and discussions of the GLCanvas 'API'.
52 (Gloger@lrz.uni-muenchen.de)