minor stuff

svn path=/trunk/boinc_samples/; revision=13680
This commit is contained in:
David Anderson 2007-09-27 04:38:47 +00:00
parent 9802607644
commit aa29d13ac3
3 changed files with 17 additions and 2 deletions

View File

@ -481,3 +481,10 @@ David 26 Sept 2007
example_app/
uc2.C
David 26 Sept 2007
- minor stuff
example_app
uc2.C
uc2_graphics.C

View File

@ -55,6 +55,8 @@
#include "mfile.h"
#include "graphics2.h"
#define APP_GRAPHICS
#ifdef APP_GRAPHICS
#include "uc2.h"
UC_SHMEM* shmem;
@ -179,6 +181,10 @@ int main(int argc, char **argv) {
// create shared mem segment for graphics, and arrange to update it
//
shmem = (UC_SHMEM*)boinc_graphics_make_shmem("uppercase", sizeof(UC_SHMEM));
if (!shmem) {
fprintf(stderr, "failed to create shared mem segment\n");
}
update_shmem();
boinc_register_timer_callback(update_shmem);
#endif

View File

@ -152,8 +152,10 @@ void app_graphics_render(int xs, int ys, double time_of_day) {
// boinc_parse_init_data_file()
// Put this in the main loop to allow retries if the
// worker application has not yet created shared memory
if (shmem == NULL)
//
if (shmem == NULL) {
shmem = (UC_SHMEM*)boinc_graphics_get_shmem("uppercase");
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -258,7 +260,7 @@ int main(int argc, char** argv) {
#endif
boinc_parse_init_data_file();
boinc_get_init_data(uc_aid);
if (uc_aid.project_preferences) {
if (uc_aid.project_preferences) {
parse_project_prefs(uc_aid.project_preferences);
}
boinc_graphics_loop(argc, argv);