Changes between Version 3 and Version 4 of GraphicsApi


Ignore:
Timestamp:
Aug 22, 2007, 2:29:09 PM (17 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GraphicsApi

    v3 v4  
    66
    77 * If invoked with --fullscreen, it must open a full-screen borderless window, and must exit when mouse or keyboard input occurs.
    8  * Otherwise it must open a standard window; in this case it may handle mouse/keyboard input.
     8 * If not invoked with --fullscreen, it must open a standard window; in this case it may handle mouse/keyboard input.
    99
    1010The BOINC graphics API (described below) provides cross-platform support for
     
    2020== The BOINC Graphics API ==
    2121
     22BOINC supplies a library (libboinc_graphics2.a) that makes it easy
     23to develop graphics apps.
     24To use this library, the graphics app must call
     25{{{
     26boinc_graphics_loop(int argc, char** argv);
     27}}}
     28after its initialization.
     29This function executes an event loop, and does not return.
     30
     31The application must supply the following functions:
     32{{{
     33void app_graphics_render(int xs, ys, double time_of_day);
     34void app_graphics_resize(int x, int y);
     35void boinc_app_mouse_move();
     36void boinc_app_mouse_button();
     37void boinc_app_key_press();
     38void boinc_app_key_release();
     39}}}
     40These functions are described [GraphicsApi here].
     41
     42== Communicating with the main application ==
     43
     44Typically the graphics app will want to get information from the main app.
     45This can be done efficiently using shared memory.
     46The BOINC library supplies the following functions to facilitate this:
     47{{{
     48void* boinc_graphics_make_shmem(char* appname, int size);
     49void* boinc_graphics_get_shmem(char* appname);
     50}}}
     51boinc_graphics_make_shmem() (called from the main app) creates a shared memory segment
     52of the given size.  'appname' should be the name of this application
     53(used to ensure uniqueness of the shared-memory segment name).
     54boinc_graphics_get_shmem() (called from the graphics app) attaches to an existing segment.
     55
     56The contents of the shared memory segment are up to you.
     57You may want to include the following items:
     58{{{
     59struct UC_SHMEM {
     60    double update_time;
     61    double fraction_done;
     62    double cpu_time;
     63    BOINC_STATUS status;
     64};
     65}}}
     66
     67 update_time:: the time of day when this structure was last modified.  This can be used to implement a 'heartbeat' mechanism so that the graphics app will exit if the main app dies.
     68 fraction_done:: the last fraction done reported by the main app.
     69 cpu_time:: the last CPU time reported by the main app.
     70 status:: the BOINC status.  If the 'suspended' flag is set, the graphics app should stop changing its display, and simply display an "application suspended" message.