Changes between Version 7 and Version 8 of GraphicsApi
- Timestamp:
- Oct 4, 2007, 4:25:20 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GraphicsApi
v7 v8 4 4 5 5 Starting with BOINC version 6.0, 6 application s graphics are generated by a separateprogram.7 The only constraints on this programare:6 application graphics are generated by a separate 'graphics app' program. 7 The only constraints on a graphics app are: 8 8 9 * If invoked with `--fullscreen`, it opens a full-screen borderless window, and must exit when mouse or keyboard input occurs.10 * If not invoked with `--fullscreen`, it opens a standard window, and itmay handle mouse/keyboard input.9 * If invoked with `--fullscreen`, it opens a full-screen borderless window, and must exit on mouse or keyboard input. 10 * Otherwise it opens a standard window, and may handle mouse/keyboard input. 11 11 12 12 The graphics app is launched by the BOINC Manager and by the screensaver. … … 17 17 18 18 The BOINC graphics API (described below) provides cross-platform support for 19 developing such a program;19 developing graphics apps; 20 20 however, you need not use it. 21 21 22 The logical name of the program must be ' v6graphics'.22 The logical name of the program must be 'graphics_app'. 23 23 When you set up your application version directory, give it a filename like 24 24 {{{ 25 v6graphics=uc2_graphics_5.10_windows_intelx86.exe25 graphics_app=uc2_graphics_5.10_windows_intelx86.exe 26 26 }}} 27 27 … … 49 49 == Communicating with the main application == 50 50 51 T ypically the graphics app willwant to get information from the main app.51 The graphics app may want to get information from the main app. 52 52 This can be done efficiently using shared memory. 53 53 The BOINC library supplies the following functions to facilitate this: … … 56 56 void* boinc_graphics_get_shmem(char* appname); 57 57 }}} 58 `boinc_graphics_make_shmem()` (called from the main app) creates a shared memory segment of the given size. 'appname' should be the name of this application (used to ensure uniqueness of the shared-memory segment name). `boinc_graphics_get_shmem()` (called from the graphics app) attaches to an existing segment. 58 `boinc_graphics_make_shmem()` (called from the main app) creates a shared memory segment of the given size. 59 'appname' should be the name of this application (used to ensure uniqueness of the shared-memory segment name). `boinc_graphics_get_shmem()` (called from the graphics app) attaches to an existing segment. 59 60 60 61 The contents of the shared memory segment are up to you. … … 69 70 }}} 70 71 71 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. 72 This structure should be updated by the main app once per second, 73 using [BasicApi#Registeringatimerhandler boinc_set_timer_handler()]. 74 The items are: 75 update_time:: The current time (dtime()). The graphics app should exit if the current time exceeds this by 5 seconds or so. 72 76 fraction_done:: The last fraction done reported by the main app. 73 cpu_time:: The last CPU time reported by the main app.77 cpu_time:: The current CPU time. 74 78 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. 75 79 76 You may want to use a semaphore to synchronize access to the shared memory.77 80 Keep in mind that multiple instances of the graphics app may run simultaneously; 78 81 avoid having the graphics app write to the shared memory. 82 If you use shared memory to store a data structure, 83 use a semaphore to synchronize access so that the graphics app 84 doesn't see an inconsistent state.