Supported Browsers Home   
MGL_sectRegionRect Previous   
MGL_setActivePage Next   
External Functions Up   

MGL_selectDisplayDevice

Selects the specified display device as the active device.

Declaration

int MGLAPI MGL_selectDisplayDevice(
    int device)

Prototype In

mgraph.h

Parameters

device

New display device index to make active

 

Return Value

Index of previously active device, or -1 on failure.

Description

This function is used to select one of the attached display devices as the active display device from this point forward. This function is used to change the active display device after a call to MGL_init, and all subsequent calls to device initialisation functions work with the new active device. The device numbering starts at 0 for the primary display controller, and increments by one for each supports display controller. Ie: the second controller is device 1 while the third controller is device 2 etc. The maximum number of display devices is defined by the compile time constant MAX_DISPLAY_DEVICES.

You can also select a 'mixed' mode of operation by passing in the MM_MODE_MIXED parameter, which fully enables the primary display controller but only enables the secondary display controllers relocateable memory mapped regions. If this mode is selected, you must have first initialised all attached secondary controllers to a graphics display mode or this call will fail.

Note:    Some older display controllers cannot support mixed mode as the VGA compatible resources cannot be disabled. These controllers will still work fine, however there is more overhead involved in the calls to MGL_makeCurrentDC as this function must switch the active display device every time it is called. If mixed mode is enabled, the MGL_makeCurrentDC function does not have any extra overhead for multiple display controller support.

The general function call sequence to use multiple controllers in the MGL is as follows:

int     numDevices,device,mode;
MGLDC   *dc[MAX_DISPLAY_DEVICES];

// Initialise the library
if ((numDevices = MGL_init(".",NULL)) == 0)
    MGL_fatalError(MGL_errorMsg(MGL_result()));
for (device = 0; device < numDevices; device++) {
    MGL_selectDisplayDevice(device);
    if ((mode = MGL_findMode(640,480,8)) == -1)
        MGL_fatalError(MGL_errorMsg(MGL_result()));
    dc[device] = MGL_createDisplayDC(mode,1,MGL_DEFAULT_REFRESH);
    if (!dc[device])
        MGL_fatalError(MGL_errorMsg(MGL_result()));
    }
MGL_selectDisplayDevice(MM_MODE_MIXED);

// Now draw something on each device
for (device = 0; device < numDevices; device++) {
    MGL_makeCurrentDC(dc[0]);
    MGL_line(0,0,10,10);
    }

// Now close down the MGL
MGL_exit();

Note:    Once you have initialised the display and created a display device context for each of the displays in the system, you do not need to call this function to switch the active display from within your rendering code. This is handled automatically by the MGL_makeCurrentDC function every time you switch the active MGL device context.

See Also

MGL_init, MGL_enableAllDrivers, MGL_disableDriver, MGL_availablePages, MGL_modeResolution, MGL_findMode, MGL_addCustomMode, MGL_createDisplayDC, MGL_exit, MGL_result

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com