next up previous contents index
Next: Primitive Graphic Routines Up: Graphic Devices Previous: Device

GraphicDevice

 

The class GraphicDevice is only a superclass for the different classes representing the different hardware platforms. Recently implemented subclasses are

The class GraphicDevice defines all pointers to the primitive functions containing the graphic output routines. The instance variable info points to a machine dependent structure containing the device's static variables, it is for internal use only.

As the graphics interface is one of the main parts of GRAPE, and should support any new hardware features, it is constantly worked on, so many of its parts are still in experimental state. The main functions like move, draw, begin_patch, patch_vertex, patch_normal, end_patch, transform, attribute, the light sources, are, however, stable and non-changing.

The structure of the class GraphicDevice is defined as follows:

 

#CLASS GraphicDevice : Device {
  int *info;               /* pointer to device specific informations */
  void (*update)(void);    /* this has to be the first pointer */
  void (*clear)(void);
  void (*message)(long, char *);
  int  (*attribute)(int, int, void *);
  void (*transform)(int, int, MATRIX44);
  void (*move)(VEC3);
  void (*draw)(VEC3);
  void (*begin_patch)(void);
  void (*patch_vertex)(VEC3);
  void (*patch_vertex_index)(int);
  void (*patch_normal)(VEC3);
  void (*patch_color)(VEC3);
  void (*end_patch)(void);
  void (*move_direct)(VEC3);             /* internal use only */
  void (*draw_direct)(VEC3);             /* internal use only */
  void (*begin_patch_direct)(void);      /* internal use only */
  void (*patch_vertex_direct)(VEC3);     /* internal use only */
  void (*patch_normal_direct)(VEC3);     /* internal use only */
  void (*patch_color_direct)(VEC3);      /* internal use only */
  void (*end_patch_direct)(void);        /* internal use only */
  void (*color_alpha)(VEC3);
  void (*texture_init)(unsigned char *,unsigned int, int, int);
  void (*texture_coord)(double, double);
  int (*begin_list)(void);     /* These Display-List functions are used for */
  void (*end_list)(void);      /* small temporary lists like a list for a   */
  int (*call_list)(int);       /* isocaeder. They should be deleted at the  */
  void (*delete_list)(int);    /* end of the display-method.                */
  int  (*generate_lightsource)(int);
  void (*lightsource)(int, int, LIGHTSOURCE_DEV *);
  void (*delete_lightsource)(int);
  void (*text)(VEC3, char *);
  void (*set_full_screen)(int);
  void (*video_record_function)(void);

  int grid_patch;        /* G_PATCH patch is available; G_GRID always grid */
  int interactive;       /* OFF handle not available: else ON */
  int global_grid_patch; /* supervises grid_patch */
 } GRAPHICDEVICE;

A program has access to the primitive graphic routines for the actual device if it demands a pointer to the standard device by the command line

dev = (GRAPHICDEVICE *) GRAPE(GraphicDevice, "get-stddev")();
The pointer has to be updated if the standard device might have changed. The variables must not be changed by hand and even the function pointers can change when switching methods are called.

Now a brief description for the primitive graphic routines:





SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.