Panda3D
 All Classes Functions Variables Enumerations
pandagl.cxx
1 // Filename: pandagl.cxx
2 // Created by: drose (15May00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 
6 #include "pandagl.h"
7 
8 #include "config_glgsg.h"
9 
10 #ifdef HAVE_WGL
11 #include "config_wgldisplay.h"
12 #include "wglGraphicsPipe.h"
13 #endif
14 
15 #if defined(HAVE_COCOA)
16 #include "config_cocoadisplay.h"
17 #include "cocoaGraphicsPipe.h"
18 #elif defined(HAVE_CARBON)
19 #include "config_osxdisplay.h"
20 #include "osxGraphicsPipe.h"
21 #endif
22 
23 #ifdef HAVE_GLX
24 #include "config_glxdisplay.h"
25 #include "glxGraphicsPipe.h"
26 #endif
27 
28 #if !defined(HAVE_WGL) && !defined(HAVE_COCOA) && !defined(HAVE_CARBON) && !defined(HAVE_GLX)
29 #error One of HAVE_WGL, HAVE_COCOA, HAVE_CARBON or HAVE_GLX must be defined when compiling pandagl!
30 #endif
31 
32 // By including checkPandaVersion.h, we guarantee that runtime
33 // attempts to load libpandagl.so/.dll will fail if they inadvertently
34 // link with the wrong version of libdtool.so/.dll.
35 
36 #include "checkPandaVersion.h"
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: init_libpandagl
40 // Description: Initializes the library. This must be called at
41 // least once before any of the functions or classes in
42 // this library can be used. Normally it will be
43 // called by the static initializers and need not be
44 // called explicitly, but special cases exist.
45 ////////////////////////////////////////////////////////////////////
46 void
47 init_libpandagl() {
48  init_libglgsg();
49 
50 #ifdef HAVE_WGL
51  init_libwgldisplay();
52 #endif // HAVE_GL
53 
54 #if defined(HAVE_COCOA)
55  init_libcocoadisplay();
56 #elif defined(HAVE_CARBON)
57  init_libosxdisplay();
58 #endif
59 
60 #ifdef IS_LINUX
61  init_libglxdisplay();
62 #endif
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: get_pipe_type_pandagl
67 // Description: Returns the TypeHandle index of the recommended
68 // graphics pipe type defined by this module.
69 ////////////////////////////////////////////////////////////////////
70 int
71 get_pipe_type_pandagl() {
72 #ifdef HAVE_WGL
73  return wglGraphicsPipe::get_class_type().get_index();
74 #endif
75 
76 #if defined(HAVE_COCOA)
77  return CocoaGraphicsPipe::get_class_type().get_index();
78 #elif defined(HAVE_CARBON)
79  return osxGraphicsPipe::get_class_type().get_index();
80 #endif
81 
82 #ifdef HAVE_GLX
83  return glxGraphicsPipe::get_class_type().get_index();
84 #endif
85 
86  return 0;
87 }
int get_index() const
Returns the integer index associated with this TypeHandle.
Definition: typeHandle.I:253