gramods
UvcTexture.hh
1 
2 #ifndef GRAMODS_GRAPHICS_UVCTEXTURE
3 #define GRAMODS_GRAPHICS_UVCTEXTURE
4 
5 #include <gmGraphics/config.hh>
6 
7 #ifdef gramods_ENABLE_libuvc
8 
9 // Required before gmCore/OFactory.hh for some compilers
10 #include <gmCore/io_size.hh>
11 
12 #include <gmCore/OFactory.hh>
13 #include <gmCore/VideoSource.hh>
14 
15 #include <gmGraphics/Texture.hh>
16 #include <memory>
17 
18 BEGIN_NAMESPACE_GMGRAPHICS;
19 
24 class UvcTexture :
25 #ifdef gramods_ENABLE_OpenCV
26  public gmCore::VideoSource,
27 #endif
28  public gmGraphics::Texture {
29 
30 public:
31 
32  UvcTexture();
33 
34  void initialize() override;
35 
51  GLuint updateTexture(size_t frame_number, Eye eye) override;
52 
60  void setVendor(int v) { vendor = v; }
61 
69  void setProduct(int p) { product = p; }
70 
76  void setSerial(std::string s) { serial = s; }
77 
83  void setResolution(gmCore::size2 res);
84 
90  void setFramerate(int fps);
91 
102  void setFormat(std::string fmt);
103 
117  void setDecode(bool on);
118 
123  bool triggerStill(gmCore::size2 res);
124 
125 #ifdef gramods_ENABLE_OpenCV
126 
135  bool retrieve(cv::Mat &image) override;
136 
137 #endif
138 
139  GM_OFI_DECLARE;
140 
141 private:
142 
143  struct Impl;
144  std::unique_ptr<Impl> _impl;
145 
146  int vendor;
147  int product;
148  std::string serial;
149 };
150 
151 END_NAMESPACE_GMGRAPHICS;
152 
153 #endif
154 #endif
The base of classes providing texture data for rendering.
Definition: Texture.hh:18
The UvcTexture connects to a USB video class device and populates its texture data with RGB streamed ...
Definition: UvcTexture.hh:28
void setProduct(int p)
Set the product ID of the UVC device to stream from.
Definition: UvcTexture.hh:69
void setSerial(std::string s)
Set the serial ID of the UVC device to stream from.
Definition: UvcTexture.hh:76
void setVendor(int v)
Set the vendor ID of the UVC device to stream from.
Definition: UvcTexture.hh:60
std::array< size_t, 2 > size2
Array of 2 size_t.
Definition: io_size.hh:9
An indexed eye that can be rendered.
Definition: Eye.hh:20