Panda3D
 All Classes Functions Variables Enumerations
config_vision.cxx
1 // Filename: config_vision.cxx
2 // Created by: pro-rsoft (07Nov09)
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_vision.h"
16 #include "openCVTexture.h"
17 #include "webcamVideo.h"
18 #include "webcamVideoCursorOpenCV.h"
19 #include "webcamVideoOpenCV.h"
20 #include "webcamVideoCursorV4L.h"
21 #include "webcamVideoV4L.h"
22 
23 #include "pandaSystem.h"
24 #include "texturePool.h"
25 #include "dconfig.h"
26 
27 Configure(config_vision);
28 NotifyCategoryDef(vision, "");
29 
30 ConfigureFn(config_vision) {
31  init_libvision();
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: init_libvision
36 // Description: Initializes the library. This must be called at
37 // least once before any of the functions or classes in
38 // this library can be used. Normally it will be
39 // called by the static initializers and need not be
40 // called explicitly, but special cases exist.
41 ////////////////////////////////////////////////////////////////////
42 void
43 init_libvision() {
44  static bool initialized = false;
45  if (initialized) {
46  return;
47  }
48  initialized = true;
49 
50  WebcamVideo::init_type();
51 #ifdef HAVE_VIDEO4LINUX
52  WebcamVideoCursorV4L::init_type();
53  WebcamVideoV4L::init_type();
54 #endif
55 
56 #ifdef HAVE_OPENCV
57  WebcamVideoCursorOpenCV::init_type();
58  WebcamVideoOpenCV::init_type();
59 
60  OpenCVTexture::init_type();
61  OpenCVTexture::register_with_read_factory();
62 
64  ps->add_system("OpenCV");
65 
67 #ifndef HAVE_FFMPEG
68  ts->register_texture_type(OpenCVTexture::make_texture, "avi");
69 #endif
70 #endif
71 }
72 
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
void add_system(const string &system)
Intended for use by each subsystem to register itself at startup.
void register_texture_type(MakeTextureFunc *func, const string &extensions)
Records a factory function that makes a Texture object of the appropriate type for one or more partic...
Definition: texturePool.cxx:55
static TexturePool * get_global_ptr()
Initializes and/or returns the global pointer to the one TexturePool object in the system...
This is the preferred interface for loading textures from image files.
Definition: texturePool.h:40