source: trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc @ 893

Last change on this file since 893 was 893, checked in by garnier, 15 years ago

make 3.80 added because 3.81 is bad

  • Property svn:mime-type set to text/cpp
File size: 18.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31// Andrew Walkden  7th February 1997
32// G4OpenGLXViewer : Class to provide XWindows specific
33//                 functionality for OpenGL in GEANT4
34
35#ifdef G4VIS_BUILD_OPENGLX_DRIVER
36
37#include "G4OpenGLXViewer.hh"
38
39#include "G4OpenGLFontBaseStore.hh"
40
41#include <sstream>
42
43#include "G4VisExtent.hh"
44#include "G4LogicalVolume.hh"
45#include "G4VSolid.hh"
46#include "G4Point3D.hh"
47#include "G4Normal3D.hh"
48
49#include <X11/Xatom.h>
50#include <X11/Xutil.h>
51
52#include <assert.h>
53
54int G4OpenGLXViewer::snglBuf_RGBA[12] =
55{ GLX_RGBA,
56  GLX_RED_SIZE, 1,
57  GLX_GREEN_SIZE, 1,
58  GLX_BLUE_SIZE, 1,
59  GLX_DEPTH_SIZE, 1,
60  GLX_STENCIL_SIZE, 1,
61  None };
62
63int G4OpenGLXViewer::dblBuf_RGBA[13] =
64{ GLX_RGBA,
65  GLX_RED_SIZE, 1,
66  GLX_GREEN_SIZE, 1,
67  GLX_BLUE_SIZE, 1,
68  GLX_DOUBLEBUFFER,
69  GLX_DEPTH_SIZE, 1,
70  GLX_STENCIL_SIZE, 1,
71  None };
72
73#define NewString(str) \
74 ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
75
76#define USE_DEFAULT_COLORMAP 1
77#define USE_STANDARD_COLORMAP 0
78
79XVisualInfo*  G4OpenGLXViewer::vi_single_buffer = 0;
80XVisualInfo*  G4OpenGLXViewer::vi_double_buffer = 0;
81
82extern "C" {
83  static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
84    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
85  }
86}
87
88void G4OpenGLXViewer::SetView () {
89  glXMakeCurrent (dpy, win, cx);
90  G4OpenGLViewer::SetView (); 
91}
92
93void G4OpenGLXViewer::ShowView () {
94  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
95                //be propagated before progressing.
96  glFlush ();
97
98  if (fVP.IsPicking()) {
99    G4cout <<
100      "Window activated for picking (left-mouse), exit (middle-mouse)."
101           << G4endl;
102    while (true) {
103      if (XPending(dpy)) {
104        XNextEvent(dpy, &event);
105        if (event.type == ButtonPress && event.xbutton.button == 1) {
106          Pick(event.xbutton.x, event.xbutton.y);
107        }
108        else if (event.type == ButtonPress && event.xbutton.button == 2) break;
109      }
110    }
111  }
112}
113
114void G4OpenGLXViewer::GetXConnection () {
115// get a connection.
116  dpy = XOpenDisplay (0);
117  if (!dpy) {
118    fViewId = -1;  // This flags an error.
119    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't open display." << G4endl;
120    return;
121  }
122
123// make sure OpenGL is supported and installed properly.
124  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
125    fViewId = -1;  // This flags an error.
126    G4cerr << "G4OpenGLViewer::G4OpenGLViewer X Server has no GLX extension."
127         << G4endl;
128    return;
129  }
130
131}
132
133void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
134
135  vi = v;
136// get window's attributes
137  if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
138    fViewId = -1;  // This flags an error.
139    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't return window attributes"
140         << G4endl;
141    return;
142  }
143 
144// create a GLX context
145  cx = glXCreateContext (dpy, vi, 0, true);
146  if (!cx) {
147    fViewId = -1;  // This flags an error.
148    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't create context."
149         << G4endl;
150    return;
151  }
152
153// New stab at getting a colormap
154
155  Status status;
156  XStandardColormap *standardCmaps = XAllocStandardColormap ();
157  int i, numCmaps;
158
159  status = XmuLookupStandardColormap (dpy,
160                                      vi -> screen,
161                                      vi -> visualid,
162                                      vi -> depth,
163                                      XA_RGB_DEFAULT_MAP,
164                                      False,
165                                      True);
166 
167  if (status == 1) {
168    cmap = 0;
169    status = XGetRGBColormaps (dpy,
170                               XRootWindow (dpy, vi -> screen),
171                               &standardCmaps,
172                               &numCmaps,
173                               XA_RGB_DEFAULT_MAP);
174    if (status == 1)
175      for (i = 0; i < numCmaps; i++) {
176        if (standardCmaps[i].visualid == vi -> visualid) {
177          cmap = standardCmaps[i].colormap;
178          XFree (standardCmaps);
179          break;
180        }
181      }
182    if (!cmap) {
183      fViewId = -1;  // This flags an error.
184      G4cerr <<
185   "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
186             << G4endl;
187      return;
188    }
189    G4cout << "Got standard cmap" << G4endl;
190  } else {
191    cmap = XCreateColormap (dpy,
192                            XRootWindow(dpy, vi -> screen),
193                            vi -> visual,
194                            AllocNone);
195    G4cout << "Created own cmap" << G4endl;
196  }
197
198  if (!cmap) {
199    fViewId = -1;  // This flags an error.
200    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
201         << G4endl;
202    return;
203  }
204
205}
206 
207void G4OpenGLXViewer::CreateMainWindow () {
208 
209// create a window
210  swa.colormap = cmap;
211  swa.border_pixel = 0;
212  swa.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask;
213  swa.backing_store = WhenMapped;
214
215  // Window size and position...
216  unsigned int width, height;
217  x_origin = 0;
218  y_origin = 0;
219  size_hints = XAllocSizeHints();
220
221  // already done in G4VViewer at creation
222
223//   const G4String& XGeometryString = fVP.GetXGeometryString();
224//   int screen_num = DefaultScreen(dpy);
225//   if (!XGeometryString.empty()) {
226//     G4int geometryResultMask = XParseGeometry
227//       ((char*)XGeometryString.c_str(),
228//        &x_origin, &y_origin, &width, &height);
229//     if (geometryResultMask & (WidthValue | HeightValue)) {
230//       if (geometryResultMask & XValue) {
231//      if (geometryResultMask & XNegative) {
232//        x_origin = DisplayWidth(dpy, screen_num) + x_origin - width;
233//      }
234//      size_hints->flags |= PPosition;
235//      size_hints->x = x_origin;
236//       }
237//       if (geometryResultMask & YValue) {
238//      if (geometryResultMask & YNegative) {
239//        y_origin = DisplayHeight(dpy, screen_num) + y_origin - height;
240//      }
241//      size_hints->flags |= PPosition;
242//      size_hints->y = y_origin;
243//       }
244//     } else {
245//       G4cout << "ERROR: Geometry string \""
246//           << XGeometryString
247//           << "\" invalid.  Using \"600x600\"."
248//           << G4endl;
249//       width = 600;
250//       height = 600;
251//     }
252//   }
253//  size_hints->width = width;
254//  size_hints->height = height;
255
256#ifdef G4DEBUG
257  printf("G4OpenGLXViewer::CreateMainWindow CreateWindow Mauvais Size:W:%d X:%d H:%d Y:%d \n",width,fVP.GetWindowSizeHintX(),height, fVP.GetWindowSizeHintY());
258#endif
259
260  size_hints->width = fVP.GetWindowSizeHintX();
261  size_hints->height = fVP.GetWindowSizeHintY();
262  size_hints->flags |= PSize;
263
264  //  G4int                             WinSize_x;
265  //  G4int                             WinSize_y;
266  WinSize_x = fVP.GetWindowSizeHintX();
267  WinSize_y = fVP.GetWindowSizeHintY();
268  x_origin = fVP.GetWindowLocationHintX();
269  y_origin = fVP.GetWindowLocationHintY();
270
271#ifdef G4DEBUG
272  printf("G4OpenGLXViewer::CreateMainWindow CreateWindow Size:W:%d H:%d X:%d Y:%d \n",WinSize_x,WinSize_y,x_origin,y_origin);
273#endif
274
275  G4cout << "Window name: " << fName << G4endl;
276  strncpy (charViewName, fName, 100);
277  char *window_name = charViewName;
278  char *icon_name = charViewName;
279  //char tmpatom[] = "XA_WM_NORMAL_HINTS";
280  wm_hints = XAllocWMHints();
281  class_hints = XAllocClassHint();
282
283  XStringListToTextProperty (&window_name, 1, &windowName);
284  XStringListToTextProperty (&icon_name, 1, &iconName);
285
286  wm_hints -> initial_state = NormalState;
287  wm_hints -> input = True;
288  wm_hints -> icon_pixmap = icon_pixmap;
289  wm_hints -> flags = StateHint | IconPixmapHint | InputHint;
290
291  class_hints -> res_name  = NewString("G4OpenGL");
292  class_hints -> res_class = NewString("G4OpenGL");
293
294  win = XCreateWindow (dpy, XRootWindow (dpy, vi -> screen), x_origin,
295                       y_origin, WinSize_x, WinSize_y, 0, vi -> depth,
296                       InputOutput, vi -> visual, 
297                       CWBorderPixel | CWColormap |
298                       CWEventMask | CWBackingStore,
299                       &swa);
300 
301  XSetWMProperties (dpy, win, &windowName, &iconName, 0, 0,
302                    size_hints, wm_hints, class_hints);
303 
304// request X to Draw window on screen.
305  XMapWindow (dpy, win);
306
307// Wait for window to appear (wait for an "expose" event).
308  XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
309
310// connect the context to a window
311  Bool success = glXMakeCurrent (dpy, win, cx);
312  if (!success) {
313    fViewId = -1;  // This flags an error.
314    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
315         << G4endl;
316    GLint error = GL_NO_ERROR;
317    while ((error = glGetError()) != GL_NO_ERROR) {
318      G4cout << "GL Error: " << gluErrorString(error) << G4endl;
319    }
320    return;
321  }
322
323}
324
325void G4OpenGLXViewer::CreateFontLists () {
326
327  std::map<G4double,G4String> fonts;  // G4VMarker screen size and font name.
328  fonts[10.] = "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1";
329  fonts[11.] = "-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1";
330  fonts[12.] = "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1";
331  fonts[13.] = "fixed";
332  fonts[14.] = "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1";
333  fonts[17.] = "-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1";
334  fonts[18.] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1";
335  fonts[20.] = "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1";
336  fonts[24.] = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1";
337  fonts[25.] = "-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1";
338  fonts[34.] = "-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1";
339  std::map<G4double,G4String>::const_iterator i;
340  for (i = fonts.begin(); i != fonts.end(); ++i) {
341    XFontStruct* font_info = XLoadQueryFont(dpy, i->second);
342    if (!font_info) {
343      G4cerr <<
344        "G4OpenGLXViewer: XLoadQueryFont failed for font\n  "
345             << i->second
346             << G4endl;
347      continue;
348    }
349    G4int font_base = glGenLists(256);
350    if (!font_base) {
351      G4cerr << "G4OpenGLXViewer: out of display lists for fonts."
352             << G4endl;
353      continue;
354    }
355    G4int first = font_info->min_char_or_byte2;
356    G4int last  = font_info->max_char_or_byte2;
357    glXUseXFont(font_info->fid, first, last-first+1,font_base+first);
358    G4OpenGLFontBaseStore::AddFontBase(this,font_base,i->first,i->second);
359  }
360}
361
362G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene):
363G4VViewer (scene, -1),
364G4OpenGLViewer (scene),
365vi_immediate (0),
366vi_stored (0),
367vi (0),
368cmap (0)
369{
370  GetXConnection ();
371  if (fViewId < 0) return;
372 
373  // Try for a visual suitable for OpenGLImmediate..
374  // first try for a single buffered RGB window
375  if (!vi_single_buffer) {
376    vi_single_buffer =
377      glXChooseVisual (dpy, XDefaultScreen (dpy), snglBuf_RGBA);
378  }
379  if (!vi_double_buffer) {
380    vi_double_buffer =
381      glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA);
382  }
383
384  if (vi_single_buffer || vi_double_buffer) {
385    if (!vi_double_buffer) {
386      G4cout <<
387        "G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
388        "\n  Working with a single buffer."
389             << G4endl;
390    }
391  } else {
392    if (!vi_single_buffer) {
393      G4cout <<
394        "G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual."
395             << G4endl;
396    }
397    if (!vi_double_buffer) {
398      G4cout <<
399        "G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
400             << G4endl;
401    }
402  }
403
404  if (vi_single_buffer) {
405    vi_immediate = vi_single_buffer;
406    attributeList = snglBuf_RGBA;
407  }
408 
409  if (!vi_immediate){
410    // next try for a double buffered RGB, but Draw to top buffer
411    if (vi_double_buffer) {
412      vi_immediate = vi_double_buffer;
413      attributeList = dblBuf_RGBA;
414    }
415  }
416
417  // Now try for a visual suitable for OpenGLStored...
418  // Try for a double buffered RGB window
419  if (vi_double_buffer) {
420    vi_stored = vi_double_buffer;
421    attributeList = dblBuf_RGBA;
422  }
423
424  if (!vi_immediate || !vi_stored) {
425    G4cout <<
426    "G4OpenGLXViewer::G4OpenGLXViewer: unable to get required visuals."
427           << G4endl;
428    fViewId = -1;  // This flags an error.
429  }
430
431  //  glClearColor (0., 0., 0., 0.);
432  //  glClearDepth (1.);
433}
434
435G4OpenGLXViewer::~G4OpenGLXViewer () {
436  if (fViewId >= 0) {
437    //Close a window from here
438    glXMakeCurrent (dpy, None, NULL);
439    glXDestroyContext (dpy, cx);
440    if (win) XDestroyWindow (dpy, win); // ...if already deleted in
441    // sub-class G4OpenGLXmViewer.
442    XFlush (dpy);
443  }
444}
445
446void G4OpenGLXViewer::print() {
447 
448  //using namespace std;
449  //cout << "print_col_callback requested with file name: " << print_string << G4endl;
450 
451  if (vectored_ps) {
452
453    G4OpenGLViewer::print();
454
455  } else {
456
457    XVisualInfo* pvi;
458    GLXContext pcx = create_GL_print_context(pvi);
459
460    if (!pcx) {
461      G4cout << "Unable to create print context." << G4endl;
462      return;
463    }
464
465    GLXContext tmp_cx;
466    tmp_cx = cx;
467    cx=pcx;
468   
469    Pixmap pmap = XCreatePixmap (dpy,
470                                 XRootWindow (dpy, pvi->screen),
471                                 WinSize_x, WinSize_y,
472                                 pvi->depth);
473   
474    GLXPixmap glxpmap = glXCreateGLXPixmap (dpy,
475                                            pvi,
476                                            pmap);
477   
478    GLXDrawable tmp_win;
479    tmp_win=win;
480    win=glxpmap;
481   
482    glXMakeCurrent (dpy,
483                    win,
484                    cx);
485   
486    glViewport (0, 0, WinSize_x, WinSize_y);
487   
488    ClearView ();
489    SetView ();
490    DrawView ();
491   
492    generateEPS (print_string,
493                 print_colour,
494                 WinSize_x, WinSize_y);
495   
496    win=tmp_win;
497    cx=tmp_cx;
498   
499    glXMakeCurrent (dpy,
500                    win,
501                    cx);
502   
503  }
504
505}
506
507GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
508 
509  GLubyte* buffer;
510  GLint swapbytes, lsbfirst, rowlength;
511  GLint skiprows, skippixels, alignment;
512  GLenum format;
513  int size;
514
515  if (inColor) {
516    format = GL_RGB;
517    size = width*height*3;
518  } else {
519    format = GL_LUMINANCE;
520    size = width*height*1;
521  }
522
523  buffer = new GLubyte[size];
524  if (buffer == NULL)
525    return NULL;
526
527  glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
528  glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
529  glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
530
531  glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
532  glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
533  glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
534
535  glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
536  glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
537  glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
538
539  glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
540  glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
541  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
542
543  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
544
545  glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
546  glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
547  glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
548 
549  glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
550  glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
551  glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
552 
553  return buffer;
554}
555
556int G4OpenGLXViewer::generateEPS (char* filnam,
557                                int inColour,
558                                unsigned int width,
559                                unsigned int height) {
560
561  FILE* fp;
562  GLubyte* pixels;
563  GLubyte* curpix;
564  int components, pos, i;
565
566  pixels = grabPixels (inColour, width, height);
567
568  if (pixels == NULL)
569    return 1;
570  if (inColour) {
571    components = 3;
572  } else {
573    components = 1;
574  }
575 
576  fp = fopen (filnam, "w");
577  if (fp == NULL) {
578    return 2;
579  }
580 
581  fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
582  fprintf (fp, "%%%%Title: %s\n", filnam);
583  fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
584  fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
585  fprintf (fp, "%%%%EndComments\n");
586  fprintf (fp, "gsave\n");
587  fprintf (fp, "/bwproc {\n");
588  fprintf (fp, "    rgbproc\n");
589  fprintf (fp, "    dup length 3 idiv string 0 3 0 \n");
590  fprintf (fp, "    5 -1 roll {\n");
591  fprintf (fp, "    add 2 1 roll 1 sub dup 0 eq\n");
592  fprintf (fp, "    { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
593  fprintf (fp, "       3 1 roll 5 -1 roll } put 1 add 3 0 \n");
594  fprintf (fp, "    { 2 1 roll } ifelse\n");
595  fprintf (fp, "    }forall\n");
596  fprintf (fp, "    pop pop pop\n");
597  fprintf (fp, "} def\n");
598  fprintf (fp, "systemdict /colorimage known not {\n");
599  fprintf (fp, "   /colorimage {\n");
600  fprintf (fp, "       pop\n");
601  fprintf (fp, "       pop\n");
602  fprintf (fp, "       /rgbproc exch def\n");
603  fprintf (fp, "       { bwproc } image\n");
604  fprintf (fp, "   }  def\n");
605  fprintf (fp, "} if\n");
606  fprintf (fp, "/picstr %d string def\n", width * components);
607  fprintf (fp, "%d %d scale\n", width, height);
608  fprintf (fp, "%d %d %d\n", width, height, 8);
609  fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
610  fprintf (fp, "{currentfile picstr readhexstring pop}\n");
611  fprintf (fp, "false %d\n", components);
612  fprintf (fp, "colorimage\n");
613 
614  curpix = (GLubyte*) pixels;
615  pos = 0;
616  for (i = width*height*components; i>0; i--) {
617    fprintf (fp, "%02hx ", *(curpix++));
618    if (++pos >= 32) {
619      fprintf (fp, "\n");
620      pos = 0;
621    }
622  }
623  if (pos)
624    fprintf (fp, "\n");
625
626  fprintf (fp, "grestore\n");
627  fprintf (fp, "showpage\n");
628  delete pixels;
629  fclose (fp);
630  return 0;
631}
632
633GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
634 
635  pvi = glXChooseVisual (dpy,
636                         XDefaultScreen (dpy),
637                         snglBuf_RGBA);
638
639  if (!pvi) {
640    pvi = glXChooseVisual (dpy,
641                           XDefaultScreen (dpy),
642                           dblBuf_RGBA);
643  }
644
645  return glXCreateContext (dpy,
646                           pvi,
647                           NULL,
648                           False);
649}
650
651#endif
Note: See TracBrowser for help on using the repository browser.