Please enable JavaScript to view this site.

IDS Software Suite 4.96.1

Windows_Logo
Linux_Logo

USB 2.0

USB 3.x

GigE

USB 2.0

USB 3.x

GigE

Syntax

INT is_DirectRenderer (HIDS hCam, UINT nMode, void* pParam, UINT nSize)

Description

hint_info

Note on using the function under Linux

The is_DirectRenderer() functions works under Linux only in OpenGL mode.

is_DirectRenderer() provides a set of advanced rendering functions and allows inserting overlay data into the camera's live image without flicker. The graphics card functions of the Direct3D library are supported under Windows.

The second input parameter nMode specifies the effect of the is_DirectRenderer() call.

The value of the third parameter pParam depends on the mode selected with nMode: For example, when setting the overlay size (nMode = DR_SET_OVERLAY_SIZE), a pointer to an array of two values (x and y) is passed (see code samples). When you load a bitmap image (nMode = DR_LOAD_OVERLAY_FROM_FILE), pParam passes the path to the file (see code samples). The required parameters are illustrated in the sample codes at the end of this section.

hint_attention

Note on system requirements

To use the Direct3D functionality, the appropriate version of the Microsoft DirectX Runtime has to be installed in your PC.

When you are using high-resolution cameras, the maximum texture size supported by the graphics card should be at least 4096 x 4096 pixels. You can check the maximum texture size by reading out the DR_GET_MAX_OVERLAY_SIZE parameter.

The Direct3D mode automatically uses the Windows Desktop color depth setting for the display.

Please also read the notes on graphics cards which are provided in the System requirements chapter.

hint_info

Note on displaying monochrome or raw data formats

To display monchrome or Bayer raw data in Direct3D, please set the appropriate constants using the is_SetDisplayMode() function.

The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the nSizeOfParam input parameter.

Input parameters

hCam

Camera handle

pParam

Pointer to a function parameter, whose function depends on nCommand.

nSize

Size (in bytes) of the data object or array.

Return values

When used with

DR_CHECK_COMPATIBILITY

IS_DR_DEVICE_CAPS_INSUFFICIENT

The graphics hardware does not fully support the uEye Direct3D functions.

IS_DR_CANNOT_CREATE_SURFACE

The image surface or overlay surface could not be created.

IS_DR_CANNOT_CREATE_TEXTURE

The texture could not be created.

IS_DR_CANNOT_CREATE_VERTEX_BUFFER

The vertex buffer could not be created.

IS_DR_CANNOT_GET_OVERLAY_DC

Could not get the device context handle for the overlay.

IS_DR_CANNOT_LOCK_OVERLAY_SURFACE

The overlay surface could not be locked.

IS_DR_CANNOT_RELEASE_OVERLAY_DC

Could not release the device context handle for the overlay.

IS_DR_CANNOT_UNLOCK_OVERLAY_SURFACE

The overlay surface could not be unlocked.

IS_DR_DEVICE_CAPS_INSUFFICIENT

Function is not supported by the graphics hardware.

IS_DR_DEVICE_OUT_OF_MEMORY

Not enough graphics memory available.

IS_DR_NOT_ALLOWED_WHILE_DC_IS_ACTIVE

A device context handle is still open in the application.

IS_INVALID_CAMERA_HANDLE

Invalid camera handle

IS_INVALID_PARAMETER

One of the submitted parameters is outside the valid range or is not supported for this sensor or is not available in this mode.

IS_NO_SUCCESS

General error message

IS_NOT_SUPPORTED

The camera model used here does not support this function or setting.

IS_SUCCESS

Function executed successfully

IS_TIMED_OUT

A timeout occurred. An image capturing process could not be terminated within the allowable period.

Related functions

is_SetDisplayMode()

is_SetColorMode()

is_SetImageMem()

is_RenderBitmap()

Example Supported function

UINT nType = IS_SET_DM_DIRECT3D;
if (is_DirectRenderer(m_pMainView->GetCameraHandle(), DR_GET_SUPPORTED,
                    (void*)&nType, sizeof(nType)) == IS_SUCCESS)
{
// Direct3D is supported
}
nType = IS_SET_DM_OPENGL;
if (is_DirectRenderer(m_pMainView->GetCameraHandle(), DR_GET_SUPPORTED,
                    (void*)&nType, sizeof(nType)) == IS_SUCCESS)
{
// OpenGL is supported
}

Example DC handle

//------------------------------------
//          DC-Handle              
//------------------------------------
 
// Get DC handle for Overlay
HDC hDC;
is_DirectRenderer (hCam, DR_GET_OVERLAY_DC, (void*)&hDC, sizeof (hDC));
 
// Release DC handle
is_DirectRenderer (hCam, DR_RELEASE_OVERLAY_DC, NULL, NULL);

Example overlay size and position

//------------------------------------
//          Size of overlay          
//------------------------------------
 
// Query maximum size of overlay area
UINT OverlaySize[2];
is_DirectRenderer (hCam, DR_GET_MAX_OVERLAY_SIZE,
                  (void*)OverlaySize, sizeof(OverlaySize));
INT nWidth = OverlaySize[0];
INT nHeight = OverlaySize[1];
 
// Set size of overlay area
UINT Size[2];
Size[0] = 100;
Size[1] = 120;
is_DirectRenderer (hCam, DR_SET_OVERLAY_SIZE,
                  (void*)Size, sizeof (Size));
 
// Set position of overlay area
UINT Position[2];
Position[0] = 20;
Position[1] = 0;
is_DirectRenderer (hCam, DR_SET_OVERLAY_POSITION,
                  void*)Position, sizeof (Position));

Example key color

//------------------------------------
//          Key color                
//------------------------------------
 
// Get current key color
UINT OverlayKeyColor[3];
is_DirectRenderer (hCam, DR_GET_OVERLAY_KEY_COLOR,
                  (void*)OverlayKeyColor, sizeof(OverlayKeyColor));
 
INT nRed = OverlayKeyColor[0];
INT nGreen = OverlayKeyColor[1];
INT nBlue = OverlayKeyColor[2];
 
// Set new key color
OverlayKeyColor[0] = GetRValue(m_rgbKeyColor);
OverlayKeyColor[1] = GetGValue(m_rgbKeyColor);
OverlayKeyColor[2] = GetBValue(m_rgbKeyColor);
is_DirectRenderer (hCam, DR_SET_OVERLAY_KEY_COLOR,
                  (void*)OverlayKeyColor, sizeof(OverlayKeyColor));

Example display

//------------------------------------
//          Display                
//------------------------------------
 
// Show overlay
is_DirectRenderer (hCam, DR_SHOW_OVERLAY, NULL, NULL);
 
// Hide overlay
is_DirectRenderer (hCam, DR_HIDE_OVERLAY, NULL, NULL);

Example scaling

//------------------------------------
//          Scaling                
//------------------------------------
 
// Enable scaling
is_DirectRenderer (hCam, DR_ENABLE_SCALING, NULL, NULL);
 
// Disable scaling
is_DirectRenderer (hCam, DR_DISABLE_SCALING, NULL, NULL);

Example transparency

//------------------------------------
//          Transparency                
//------------------------------------
 
// Enable semi-transparent overlay
is_DirectRenderer (hCam, DR_ENABLE_SEMI_TRANSPARENT_OVERLAY, NULL, NULL);
 
// Disable semi-transparent overlay
is_DirectRenderer (hCam, DR_DISABLE_SEMI_TRANSPARENT_OVERLAY, NULL, NULL);

Example synchronization

//------------------------------------
//          Synchronization                
//------------------------------------
 
// Enable auto-synchronization
is_DirectRenderer (hCam, DR_SET_VSYNC_AUTO, NULL, NULL);
 
// User defined synchronization: Query range and set position
UINT UserSync[2];
is_DirectRenderer (hCam, DR_GET_USER_SYNC_POSITION_RANGE,
                  (void*)UserSync, sizeof (UserSync));
INT Min = UserSync[0];
INT Max = UserSync[1];
INT SyncPosition = 400;
is_DirectRenderer (hCam, DR_SET_USER_SYNC,
                  void*)&SyncPosition, sizeof (SyncPosition));
 
// Disable synchronization
is_DirectRenderer (hCam, DR_SET_VSYNC_OFF, NULL, NULL);

Example overlay with BMP

//------------------------------------
//          BMP file
//------------------------------------
 
// Load overlay from BMP file
is_DirectRenderer (hCam, DR_LOAD_OVERLAY_FROM_FILE,
                  (void*)”c:\test.bmp”, NULL);
 
//------------------------------------
//          Delete overlay            
//------------------------------------
 
// Delete overlay area
is_DirectRenderer (hCam, DR_CLEAR_OVERLAY, NULL, NULL);

Example steal mode

//------------------------------------
//          Steal mode                
//------------------------------------
 
// Get and set color mode for image to be copied
INT nColorMode;
is_DirectRenderer (hCam, DR_GET_STEAL_FORMAT,
                  (void*)&nColorMode, sizeof (nColorMode));
 
nColorMode = IS_CM_MONO8;
is_DirectRenderer (hCam, DR_SET_STEAL_FORMAT,
                  void*)&nColorMode, sizeof (nColorMode));
 
// Copy image with function returning immediately
INT nwait = IS_DONT_WAIT;
is_DirectRenderer(hCam, DR_STEAL_NEXT_FRAME,
                (void*)&wait, sizeof (wait));

Example window handle

//------------------------------------
//          Handle to window                
//------------------------------------
 
// Set new window handle for image display
is_DirectRenderer (hCam, DR_SET_HWND,
                  (void*)&hWnd, sizeof (hWnd));

Example compatibility

//------------------------------------
//          Compatibility                
//------------------------------------
 
// Check graphics card compatibility
INT nRet = is_DirectRenderer (hCam, DR_CHECK_COMPATIBILITY, NULL, NULL);
 
if (nRet == IS_DR_DEVICE_CAPS_INSUFFICIENT )
// Graphics card does not support Direct3D

Example OpenGL under Linux

//OpenGL initialisieren
OPENGL_DISPLAY display;
display.pDisplay = NULL;
display.nWindowID = 0 /* fenster id */
 
is_InitCamera(&hCam, (void*)&display);

Example under Linux (with usage of the Cairo library)

UINT Size[2] = { 480, 480 };
is_DirectRenderer (hCam, DR_SET_OVERLAY_SIZE, (void*)Size, sizeof (Size));
 
char *pOverlayBuffer;
is_DirectRenderer(hCam, DR_GET_OVERLAY_DATA, (void*)&pOverlayBuffer, sizeof(pOverlayBuffer));
 
cairo_surface_t *surface = 0;
cairo_t *cr = 0;
int w, h;
w = Size[0];
h = Size[1];
surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, w, h, w * 4);
cr = cairo_create(surface);
cairo_set_line_width (cr, 6);
cairo_rectangle (cr, 12, 12, 232, 70);
cairo_new_sub_path (cr); cairo_arc (cr, 64, 64, 40, 0, 2* 3.14);
cairo_new_sub_path (cr); cairo_arc_negative (cr, 192, 64, 40, 0, -2*3.14);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgb (cr, 0, 0.7, 0); cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_stroke (cr);
cairo_translate (cr, 0, 128);
cairo_rectangle (cr, 12, 12, 232, 70);
cairo_new_sub_path (cr); cairo_arc (cr, 64, 64, 40, 0, 2*3.14);
cairo_new_sub_path (cr); cairo_arc_negative (cr, 192, 64, 40, 0, -2*3.14);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_set_source_rgb (cr, 0, 0, 0.9); cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_stroke (cr);
cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
                      CAIRO_FONT_WEIGHT_BOLD );
cairo_set_font_size (cr, 90.0);
cairo_move_to (cr, 10.0, 135.0);
cairo_show_text (cr, "Hello");
cairo_move_to (cr, 70.0, 165.0);
cairo_set_font_size (cr, 150.0);
cairo_text_path (cr, "uEye");
cairo_set_source_rgb (cr, 0.5, 0.5, 1);
cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_line_width (cr, 2.56);
cairo_stroke (cr);
/* draw helping lines */
cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_arc (cr, 10.0, 135.0, 5.12, 0, 2*3.14);
cairo_close_path (cr);
cairo_arc (cr, 70.0, 165.0, 5.12, 0, 2*3.14);
cairo_fill (cr);
cairo_destroy (cr);
cairo_surface_destroy (surface);
 
// update overlay
is_DirectRenderer(hCam, DR_UPDATE_OVERLAY_DATA, NULL, 0);

Sample programs

uEyeDirectRenderer

uEyeSteal

© 2022 IDS Imaging Development Systems GmbH