Changes between Version 37 and Version 38 of GraphicsApi
- Timestamp:
- Jan 5, 2015, 2:18:53 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GraphicsApi
v37 v38 3 3 4 4 A BOINC application may provide graphics (e.g. visualizations) to volunteers. 5 These graphics a ppearin two contexts:6 7 * As a screensaver .8 * In a window (opened using the Show Graphics button in the BOINC Manager).5 These 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. 9 9 10 10 == Graphics apps == … … 14 14 15 15 * 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). 18 18 * Otherwise it opens a standard window, and may handle mouse/keyboard input. 19 19 20 20 The logical name of the program must be 'graphics_app'. 21 When you set up your [AppVersionNew application version directory], 22 use an entry like 21 When you set up your [AppVersionNew application version directory], use an entry like 23 22 {{{ 24 23 <file> … … 29 28 in your version.xml file. 30 29 31 The graphics app is launched by the BOINC Manager and by the screensaver.30 The graphics app is launched by the BOINC Manager and/or by the screensaver. 32 31 It may be killed at any time. 33 32 Multiple instances of the graphics app may run at the same time … … 35 34 and then the screensaver runs and launches another instance). 36 35 37 The [#api BOINC graphics API] provides cross-platform support for 38 developing graphics apps. 36 The [#api BOINC graphics API] provides cross-platform support for developing graphics apps. 39 37 40 38 A complete example can be found in [ExampleApps boinc/samples/example_app]. … … 42 40 === The BOINC Graphics API === #api 43 41 44 BOINC supplies a library (libboinc_graphics2.a) that makes it easy to developgraphics apps.42 BOINC supplies a library (libboinc_graphics2.a) with support for graphics apps. 45 43 To use this library, the graphics app must call 46 44 {{{ … … 92 90 }}} 93 91 94 === Communicati ng with the main application===92 === Communication between main and graphics apps === 95 93 96 94 The graphics app may want to get information from the main app. 97 This can be done efficiently using shared memory. 95 This can be done using either shared memory or a file. 96 97 ==== Shared memory ==== 98 99 Communicating large amounts of data 100 can be done efficiently using shared memory. 98 101 The BOINC library supplies the following functions to facilitate this: 99 102 … … 151 154 doesn't see an inconsistent state. 152 155 153 === Efficiency ===154 155 156 Updating the shared memory structure uses CPU time, 156 157 and it's desirable to avoid this overhead if no graphics app is running. … … 163 164 164 165 See [ExampleApps the example application] for an example. 166 167 ==== File ==== 168 169 Alternatively, you can communicate data from main app to graphics app via a file. 170 The BOINC library provides two functions for this purpose. 171 The main program can call 172 {{{ 173 int boinc_write_graphics_status( 174 const char* filename, double cpu_time, double elapsed_time, 175 double fraction_done 176 ); 177 }}} 178 to write a file containing its status in XML format. 179 The graphics app can call 180 {{{ 181 int 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 }}} 186 to read and parse this file. 165 187 166 188 === Creating an icon for your applications === … … 236 258 237 259 * Add the files `api/ttfont.cpp` and `api/ttfont.h` to your application (they are not included in any BOINC library.) 238 260 * Link with the [http://www.freetype.org FreeType2] 239 261 and [http://sourceforge.net/projects/ftgl/files/FTGL%20Source/ FTGL] libraries. 240 262 Depending on how you build the FreeType2 library, FreeType2 may require the libz and libbz2 libraries.