gramods
|
The UvcTexture connects to a USB video class device and populates its texture data with RGB streamed from that device. More...
#include <UvcTexture.hh>
Classes | |
struct | Impl |
Public Member Functions | |
void | initialize () override |
Called to initialize the Object. More... | |
GLuint | updateTexture (size_t frame_number, Eye eye) override |
Updates the texture and returns the ID of the associated GL texture object. More... | |
void | setVendor (int v) |
Set the vendor ID of the UVC device to stream from. More... | |
void | setProduct (int p) |
Set the product ID of the UVC device to stream from. More... | |
void | setSerial (std::string s) |
Set the serial ID of the UVC device to stream from. More... | |
void | setResolution (gmCore::size2 res) |
Set the resolution to attempt to negotiate with the UVC device. More... | |
void | setFramerate (int fps) |
Set the framerate to attempt to negotiate with the UVC device. More... | |
void | setFormat (std::string fmt) |
Set the format to attempt to negotiate with the UVC device. More... | |
void | setDecode (bool on) |
If this is set to false, the incoming image data will be downloaded to texture as is, if true they will be converted to 8-bit RGB. More... | |
bool | triggerStill (gmCore::size2 res) |
Trigger a still image capture (UVC STILL_IMAGE_FRAME). More... | |
![]() | |
virtual std::string | getDefaultKey () override |
Returns the default key, in Configuration, for the Object. More... | |
![]() | |
Object () | |
Initializes internal data. More... | |
virtual | ~Object () |
Cleaning up internal data. More... | |
virtual void | accept (Visitor *visitor) |
Calls the visitors apply method with this as argument. More... | |
virtual void | traverse (Visitor *visitor) |
Calls the child Object's accept method, if such exist. More... | |
bool | isInitialized () |
Returns true if the Object is initialized. More... | |
Static Public Attributes | |
static gramods::gmCore::OFactory::OFactoryInformation | _gm_ofi |
The UvcTexture connects to a USB video class device and populates its texture data with RGB streamed from that device.
|
overridevirtual |
Called to initialize the Object.
This should be called once only!
Sub classes should override this method to make use of set parameter data. They should also always call its base class' implementation as well.
Reimplemented from gramods::gmCore::Object.
void gramods::gmGraphics::UvcTexture::setDecode | ( | bool | on | ) |
If this is set to false, the incoming image data will be downloaded to texture as is, if true they will be converted to 8-bit RGB.
Default is true.
Only YUYV and UYVY formats can be uploaded as texture. All other formats need to be converted to RGB. The YUV data are encoded into a 4-channel texture (RGBA8) and it is up to the client code using this texture to decode each four channel texel into two three channel RGB pixels.
XML-attribute: decode
void gramods::gmGraphics::UvcTexture::setFormat | ( | std::string | fmt | ) |
Set the format to attempt to negotiate with the UVC device.
Values recognized by UVC, but not necessarily supported by all devices, are any, uncompressed, compressed, yuyv, uyvy, rgb, bgr, mjpeg, gray8, gray16, by8, ba81, sgrbg8, sgbrg8, srggb8, sbggr8. Default is any.
XML-attribute: format
void gramods::gmGraphics::UvcTexture::setFramerate | ( | int | fps | ) |
Set the framerate to attempt to negotiate with the UVC device.
XML-attribute: framerate
|
inline |
Set the product ID of the UVC device to stream from.
As XML attribute, use the 0x prefix to enter the value in hexadecimal format.
XML-attribute: product
void gramods::gmGraphics::UvcTexture::setResolution | ( | gmCore::size2 | res | ) |
Set the resolution to attempt to negotiate with the UVC device.
XML-attribute: resolution
|
inline |
Set the serial ID of the UVC device to stream from.
XML-attribute: serial
|
inline |
Set the vendor ID of the UVC device to stream from.
As XML attribute, use the 0x prefix to enter the value in hexadecimal format.
XML-attribute: vendor
bool gramods::gmGraphics::UvcTexture::triggerStill | ( | gmCore::size2 | res | ) |
Trigger a still image capture (UVC STILL_IMAGE_FRAME).
Returns false iff still image capture could not be triggered.
|
overridevirtual |
Updates the texture and returns the ID of the associated GL texture object.
Must be called with GL context. Observe also that this method may perform off-screen rendering.
frame_number | The current frame being rendered. This number should increment by one for each frame, however it may wrap around and start over at zero. |
eye | Eye for which the texture is requested. An implementation may use different textures for different eyes or may reuse the same texture for all eyes. |
Implements gramods::gmGraphics::TextureInterface.