gramods
Classes | Public Member Functions | Static Public Attributes | List of all members
gramods::gmGraphics::UvcTexture Class Reference

The UvcTexture connects to a USB video class device and populates its texture data with RGB streamed from that device. More...

#include <UvcTexture.hh>

Inheritance diagram for gramods::gmGraphics::UvcTexture:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmGraphics::UvcTexture:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from gramods::gmGraphics::Texture
virtual std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 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
 

Detailed Description

The UvcTexture connects to a USB video class device and populates its texture data with RGB streamed from that device.

Member Function Documentation

◆ initialize()

void gramods::gmGraphics::UvcTexture::initialize ( )
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.

◆ setDecode()

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

◆ setFormat()

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

◆ setFramerate()

void gramods::gmGraphics::UvcTexture::setFramerate ( int  fps)

Set the framerate to attempt to negotiate with the UVC device.

XML-attribute: framerate

◆ setProduct()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_UvcTexture_param_product &UvcTexture::_gm_ofi(& gramods::gmGraphics::UvcTexture::setProduct ( int  p)
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

◆ setResolution()

void gramods::gmGraphics::UvcTexture::setResolution ( gmCore::size2  res)

Set the resolution to attempt to negotiate with the UVC device.

XML-attribute: resolution

◆ setSerial()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_UvcTexture_param_serial &UvcTexture::_gm_ofi(& gramods::gmGraphics::UvcTexture::setSerial ( std::string  s)
inline

Set the serial ID of the UVC device to stream from.

XML-attribute: serial

◆ setVendor()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_UvcTexture_param_vendor &UvcTexture::_gm_ofi(& gramods::gmGraphics::UvcTexture::setVendor ( int  v)
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

◆ triggerStill()

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.

◆ updateTexture()

GLuint gramods::gmGraphics::UvcTexture::updateTexture ( size_t  frame_number,
Eye  eye 
)
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.

Parameters
frame_numberThe current frame being rendered. This number should increment by one for each frame, however it may wrap around and start over at zero.
eyeEye for which the texture is requested. An implementation may use different textures for different eyes or may reuse the same texture for all eyes.
Returns
OpenGL texture ID of the updated texture

Implements gramods::gmGraphics::TextureInterface.


The documentation for this class was generated from the following files: