- Main Page
- Modules
- Files
- Related Pages

# virtual device related functions
[g2 User Interface]

## Functions
int | g2_open_vd (void)
void | g2_attach (int vd_dev, int dev)
void | g2_detach (int vd_dev, int dev)

## Detailed Description

Virtual device is a method to redirect g2 output to multiple devices. Here is an example:

        int d1 = g2_open_X11(100, 100);      create first X11 window
        int d2 = g2_open_X11(100, 100);      create 2nd X11 window

        int vd = g2_open_vd();               open a new virtual device

        g2_attach(vd, d1);                   attach d1 (1st window) to virtual device
        g2_attach(vd, d2);                   attach d2 (2nd window) to virtual device

        g2_plot(d1, 11, 11);                 output to the 1st X11 window
        g2_plot(d2, 12, 12);                 output to the 2nd X11 window
        g2_plot(vd, 13, 13);                 output to both X11 windows

## Function Documentation

void g2_attach | ( | int | vd_dev,
|  | int | dev
| ) |

  | Attach a device to virtual device vd_dev. Parameters:
  | vd_dev | virtual device (create virtual device by calling g2_open_vd() )
  | dev | device

void g2_detach | ( | int | vd_dev,
|  | int | dev
| ) |

  | Dettach a device from the virtual device vd_dev. Parameters:
  | vd_dev | virtual device
  | dev | device

int g2_open_vd | ( | void |  | ) |

| Create a new virtual device. Returns: virtual device ID