Changes between Version 37 and Version 38 of GraphicsApi


Ignore:
Timestamp:
Jan 5, 2015, 2:18:53 PM (9 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GraphicsApi

    v37 v38  
    33
    44A BOINC application may provide graphics (e.g. visualizations) to volunteers.
    5 These graphics appear in two contexts:
    6 
    7  * As a screensaver.
    8  * In a window (opened using the Show Graphics button in the BOINC Manager).
     5These graphics are shown in two contexts:
     6
     7 * As a screensaver, if selected by the user.
     8 * In a window, opened using the Show Graphics button in the BOINC Manager.
    99
    1010== Graphics apps ==
     
    1414
    1515 * If invoked with `--fullscreen`, it opens a full-screen borderless window.
    16   It must exit on mouse or keyboard input; this is handled automatically by `boinc_graphics_loop()`
    17   if you use the [#api BOINC graphics API] library.
     16  It must exit on mouse or keyboard input
     17  (if you use the [#api BOINC graphics API] library this is handled automatically).
    1818 * Otherwise it opens a standard window, and may handle mouse/keyboard input.
    1919
    2020The logical name of the program must be 'graphics_app'.
    21 When you set up your [AppVersionNew application version directory],
    22 use an entry like
     21When you set up your [AppVersionNew application version directory], use an entry like
    2322{{{
    2423<file>
     
    2928in your version.xml file.
    3029
    31 The graphics app is launched by the BOINC Manager and by the screensaver.
     30The graphics app is launched by the BOINC Manager and/or by the screensaver.
    3231It may be killed at any time.
    3332Multiple instances of the graphics app may run at the same time
     
    3534and then the screensaver runs and launches another instance).
    3635
    37 The [#api BOINC graphics API] provides cross-platform support for
    38 developing graphics apps.
     36The [#api BOINC graphics API] provides cross-platform support for developing graphics apps.
    3937
    4038A complete example can be found in [ExampleApps boinc/samples/example_app].
     
    4240=== The BOINC Graphics API === #api
    4341
    44 BOINC supplies a library (libboinc_graphics2.a) that makes it easy to develop graphics apps.
     42BOINC supplies a library (libboinc_graphics2.a) with support for graphics apps.
    4543To use this library, the graphics app must call
    4644{{{
     
    9290}}}
    9391
    94 === Communicating with the main application ===
     92=== Communication between main and graphics apps ===
    9593
    9694The graphics app may want to get information from the main app.
    97 This can be done efficiently using shared memory.
     95This can be done using either shared memory or a file.
     96
     97==== Shared memory ====
     98
     99Communicating large amounts of data
     100can be done efficiently using shared memory.
    98101The BOINC library supplies the following functions to facilitate this:
    99102
     
    151154doesn't see an inconsistent state.
    152155
    153 === Efficiency ===
    154 
    155156Updating the shared memory structure uses CPU time,
    156157and it's desirable to avoid this overhead if no graphics app is running.
     
    163164
    164165See [ExampleApps the example application] for an example.
     166
     167==== File ====
     168
     169Alternatively, you can communicate data from main app to graphics app via a file.
     170The BOINC library provides two functions for this purpose.
     171The main program can call
     172{{{
     173int boinc_write_graphics_status(
     174    const char* filename, double cpu_time, double elapsed_time,
     175    double fraction_done
     176);
     177}}}
     178to write a file containing its status in XML format.
     179The graphics app can call
     180{{{
     181int boinc_parse_graphics_status(
     182    const char* filename, double* update_time, double* cpu_time,
     183    double* elapsed_time, double* fraction_done, BOINC_STATUS* status
     184);
     185}}}
     186to read and parse this file.
    165187
    166188=== Creating an icon for your applications ===
     
    236258
    237259 * Add the files `api/ttfont.cpp` and `api/ttfont.h` to your application (they are not included in any BOINC library.)
    238  * Link with the [http://www.freetype.org FreeType2]
     260 * Link with the [http://www.freetype.org FreeType2]
    239261  and [http://sourceforge.net/projects/ftgl/files/FTGL%20Source/ FTGL] libraries.
    240262  Depending on how you build the FreeType2 library, FreeType2 may require the libz and libbz2 libraries.