Panda3D
config_glxdisplay.cxx
1 // Filename: config_glxdisplay.cxx
2 // Created by: cary (07Oct99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "config_glxdisplay.h"
16 #include "glxGraphicsBuffer.h"
17 #include "glxGraphicsPipe.h"
18 #include "glxGraphicsPixmap.h"
19 #include "glxGraphicsBuffer.h"
20 #include "glxGraphicsWindow.h"
21 #include "glxGraphicsStateGuardian.h"
22 #include "posixGraphicsStateGuardian.h"
23 #include "graphicsPipeSelection.h"
24 #include "dconfig.h"
25 #include "pandaSystem.h"
26 
27 Configure(config_glxdisplay);
28 NotifyCategoryDef(glxdisplay, "display");
29 
30 ConfigureFn(config_glxdisplay) {
31  init_libglxdisplay();
32 }
33 
34 ConfigVariableBool glx_get_proc_address
35 ("glx-get-proc-address", true,
36  PRC_DESC("Set this to true to allow the use of glxGetProcAddress(), if "
37  "it is available, to query the OpenGL extension functions. This "
38  "is the standard way to query extension functions."));
39 
40 
41 ConfigVariableBool glx_get_os_address
42 ("glx-get-os-address", true,
43  PRC_DESC("Set this to true to allow Panda to query the OpenGL library "
44  "directly using standard operating system calls to locate "
45  "addresses of extension functions. This will be done only "
46  "if glxGetProcAddress() cannot be used for some reason."));
47 
48 ConfigVariableBool glx_support_fbconfig
49 ("glx-support-fbconfig", true,
50  PRC_DESC("Set this true to enable the use of the advanced FBConfig "
51  "interface (as opposed to the older XVisual interface) "
52  "if it is available, to select a graphics visual and "
53  "create an OpenGL context."));
54 
55 ConfigVariableBool glx_support_pbuffer
56 ("glx-support-pbuffer", true,
57  PRC_DESC("Set this true to enable the use of X pbuffer-based offscreen "
58  "buffers, if available. This is usually preferred over "
59  "pixmap-based buffers, but not all drivers support them."));
60 
61 ConfigVariableBool glx_support_pixmap
62 ("glx-support-pixmap", false,
63  PRC_DESC("Set this true to enable the use of X pixmap-based offscreen "
64  "buffers. This is false by default because pixmap-based buffers "
65  "are usually slower than pbuffer-based buffers."));
66 
67 
68 ////////////////////////////////////////////////////////////////////
69 // Function: init_libglxdisplay
70 // Description: Initializes the library. This must be called at
71 // least once before any of the functions or classes in
72 // this library can be used. Normally it will be
73 // called by the static initializers and need not be
74 // called explicitly, but special cases exist.
75 ////////////////////////////////////////////////////////////////////
76 void
77 init_libglxdisplay() {
78  static bool initialized = false;
79  if (initialized) {
80  return;
81  }
82  initialized = true;
83 
84 #ifdef HAVE_GLXFBCONFIG
85  glxGraphicsBuffer::init_type();
86 #endif // HAVE_GLXFBCONFIG
87  glxGraphicsPipe::init_type();
88  glxGraphicsPixmap::init_type();
89  glxGraphicsBuffer::init_type();
90  glxGraphicsWindow::init_type();
91  glxGraphicsStateGuardian::init_type();
92  PosixGraphicsStateGuardian::init_type();
93 
95  selection->add_pipe_type(glxGraphicsPipe::get_class_type(),
96  glxGraphicsPipe::pipe_constructor);
97 
99  ps->set_system_tag("OpenGL", "window_system", "GLX");
100 }
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:29
This is a convenience class to specialize ConfigVariable as a boolean type.
This maintains a list of GraphicsPipes by type that are available for creation.
static GraphicsPipeSelection * get_global_ptr()
Returns a pointer to the one global GraphicsPipeSelection object.
bool add_pipe_type(TypeHandle type, PipeConstructorFunc *func)
Adds a new kind of GraphicsPipe to the list of available pipes for creation.
void set_system_tag(const string &system, const string &tag, const string &value)
Intended for use by each subsystem to register its set of capabilities at startup.