ADTF_DISPLAY_TOOLBOX  3.8.0 (ADTF 3.14.3)
Qt5 2D OpenGL Display and Drawers

General information on the 2D Display and Drawers

The Streaming Source 2D OpenGL Display, offers the possibility to display all Drawers which are connected to the 2D OpenGL Display via BindingProxy.
To use the 2D OpenGL Display, simply add it to the Streaming Graph and connect the Drawers to the Streaming Source.
You can use the 2D OpenGL Display multiple times and connect each Drawer to the 2D OpenGL Display where it should be displayed.

Drawers are ADTF Plugins, which are a compound of an ADTF Filter and the IDrawer interface. This means that they offer all functionality which is typically for a filter, and additionally functionality defined by the IDrawer interface. This interface offers possibilities to add and manage 2D data which is added to the canvas object provided by the 2D OpenGL Display through a callback mechanism.
The basic behaviour of a Drawer is defined by the base class cDrawer. When implementing a custom Drawer, cDrawer is subclassed, and methods are overwritten to provide the custom behaviour,
especially the cDrawer::Draw(...) method defines what data is painted on the canvas object and therefore shown on the 2D OpenGL Display.
Just use the pointer to the ICanvas Interface which will be provided through 2D OpenGL Display during the active callback routine and call the painting functions with it you want to use. Each custom Drawer (= plugin) can manage its data independently, without knowing about other Drawers.
The technique to define custom 2D Data is exclusively based on OpenGL wrapped in a conveniance API provided throught the ICanvas Interface.

Qt5 2D OpenGL Display

Introduction

This section provides information about the 2D OpenGL Display. The 2D OpenGL Display paints all Drawer data and provides some interaction with the 2D canvas.
All Drawers connected to one instance of the 2D OpenGL Display will be called and can paint their information onto the canvas. The order in which the individual Drawer will be called from the callback mechanism of the 2D OpenGL Display is defined by two properties. Each Drawer derived from cDrawer will inherit multiple properties. To specify the hierachy in which of all connected Drawers you can use the ZOrder and Parent property. The Parent property defines which coordinate system is the basis for all drawing operations done by the Drawer. The default value is "world" which is base for all Drawers. With the ZOrder property you can define which Drawer paints over other Drawers with the same parent.

Plugin Information
Plugin Filename2d_display.adtfplugin
Plugin Description2d_display.plugindescription
Plugin NameQt5 2D OpenGL Display Plugin
LicenseADTF
Support Mailsupport@digitalwerk.net
Homepage URLhttps://support.digitalwerk.net/
Plugin Versions
Plugin Version3.8.0
Plugin File Version1.0
adtf::disptb3.8.0
adtf3.14.3
adtf::ucom3.1.0
Component Information
NameQt5 2D OpenGL Display
CID2d_display.streaming_source.disptb.cid
DescriptionUse this Streaming Source to work on a 2D Canvas based on OpenGL which is extendable with ADTF Drawers.
TypeFilter
Properties
NameValueTypeDescriptionSubproperties
background_color#FFFFFFFFcStringThe background color
capture/file_prefix2D_Display_Screenshot_cStringThe name prefix of the saved screenshots
capture/file_type2tUInt32The filetype of the saved screenshotsValue List:
*.bmp = 0
*.jpeg = 1
*.png = 2
capture/keyF5cStringThe Key to press to take a screenshot
capture/path/home/build/PicturescFilepathThe path where screenshots will be saved to. Default will be the OS default pictures folder
desired_frame_rate25.000000tFloat64Target frame rate for redraws. Additional frames may be rendered on ongoing user interaction. If the widget is visible, actual frame rate may be limited by V-sync. Actual rendering frame rate can differ from sample rate on output pin, if processing speed is limited.
multisample_antialiasing0tInt32Enable multi sampling anti-aliasing. Improves image quality, at the cost of proportionally increased GPU load and VRAM cost.Extendable Value List:
off = 0
2x = 2
4x = 4
8x = 8
16x = 16
origin/x1tUInt32The offset of the x axis
origin/y1tUInt32The offset of the y axis
output/enabledfalsetBoolSend samples on the output pin.
output/height0tUInt32If height > 0, sets fixed height for output pin and snapshots. Also restricts aspect ratio.
output/width0tUInt32If width > 0, sets fixed width for output pin and snapshots. Also restricts aspect ratio.
scale/x1.000000tFloat64The scaling of the x axis
scale/y1.000000tFloat64The scaling of the y axis
title2D DisplaycStringThe title of the display window
Output Pins
NameStream TypeDescription
output adtf/image Output pin from current canvas as video data.
Input Binding Objects
NameIIDProxy OIDDescription
drawer_managerdrawermanager.dengar.drawerlib.disptb.adtf.iidIDrawerManager interface
Dynamic Pins
Dynamic Input Pinsfalse
Dynamic Output Pinsfalse
Dynamic Input Binding Pinsfalse
Dynamic Output Binding Pinsfalse
Required Interfaces
IID
qt_xsystem.osborn.services.adtf.iid
reference_clock.osborn.streaming.adtf.iid
Output Pin Stream Types
Pin Nameoutput
Meta Type Nameadtf/image
Stream Type Properties
NameValueTypeDescriptionSubproperties
data_endianess1tUInt32
format_namecString
max_byte_size0tUInt32
pixel_height0tUInt32
pixel_width0tUInt32

Usage

If a Drawer is placed in the Filter Graph, you need to connect them via the BindingProxy Interface called drawer_manager.
The interactions with the canvas are:

  • Zoom into or out of the scene (mouse wheel)
  • Move through the scene (arrow keys)
  • Move the scene (mouse left click and move)
  • Context menu (right click)
    1. Import Settings
      Allows to import settings from a layout file.
    2. Export Settings
      Export current settings to layout file. This includes all data how the scene is displayed and the hierachy of alle connected Drawers at the time of export.

The above list of the context menu is automatically provided by the 2D OpenGL Display.

Drawer Library and Packages

All interfaces and functionalities related to Drawers is provided by packages. These packages are part of the Display Toolbox. In the installation they can be found in the folder 'pkg'.
To address different needs, the functionality is split into 2 packages:

  • A basic package, called 'adtf::disptb::base', providing common functionality. It is located in folder 'adtfdisplaytoolboxbase'.
  • A package providing the core functionality of Drawers, called 'adtf::disptb::drawerlib'. It is located in folder 'adtfdisplaytoolboxdrawer'.

Relevant for developing custom Drawers is the packages 'adtf::disptb::drawerlib'.

Coordinate Systems

Part of the Drawer concept are coordinate systems. Each Drawer holds a own coordinate system in relation to the Drawer parent. You can manipulate the coordinate system of the Drawer with the provided properties of cDrawer.

  • Rotate - This property defines the angle in degrees, which is beeing used to rotate the coordinate system in relation to the Drawer parent.
  • ScaleX - This property holds the value which is used to stretch and shrink the coordinate system of the Drawer on the x-axis.
  • ScaleY - This property holds the value which is used to stretch and shrink the coordinate system of the Drawer on the y-axis.
  • TranslateX - This property holds the value which is used to relocate the Drawer coordinate system in relation to the Drawer parent on the x-axis.
  • TranslateY - This property holds the value which is used to relocate the Drawer coordinate system in relation to the Drawer parent on the y-axis.

By default all these values are set to zero.

Creating a custom drawer

You only need to create a custum class which derives from the cDrawer base class. Then just overwrite the virtual function Draw implemented in cDrawer with your own implementation.
Just take a look at our provided examples.

  • Demo 2D Drawer Example - shows how to implement basic drawing.
  • Demo Coordinate Space Drawer - prints a X/Y coordinate system onto the canvas
  • Demo GCL Drawer - interprets the received GCL Commands and prints them onto the canvas
  • Demo Image Drawer - prints a given Image onto the canvas
  • Demo Shape Drawer - interprets the received shape data and prints them onto the canvas
  • Demo Text Drawer - prints the given Text onto the canvas.
  • Demo Video Drawer - prints the received videos stream to the canvas.