Posts by lanye

1) Message boards : API : can boinc app visit local system? (Message 21645)
Posted 6 Dec 2008 by lanye
Post:
actually, there is not any window. so if available, can you tell me how to create such a graphic application by using the example uc2_graphics.cpp form the create project and configuration. i think if the system is avalibale, it should be the problem of the the process i do it.

thanks a lot!
2) Message boards : API : can boinc app visit local system? (Message 21481)
Posted 24 Nov 2008 by lanye
Post:
what does anything mean? if i write some with boinc graphic api, can it be shown on the screen?
3) Message boards : API : how to move the application to windows? (Message 21480)
Posted 24 Nov 2008 by lanye
Post:
now i implemented a application with graphic by using boinc api. and when i run the application with standalone model, the graphic works well. but when i put it on the boinc server and download it as a project, the application works but the graphic does not appear.

my boinc client is run on windows XP. and the server side is the image downloaded form http://boinc.berkeley.edu/dev. i create the project following the quick start tutorial with the command "./make_project --url_base http://a.b.c.d --test_app test". and when i compile the graphic application. i change the application name to uppercase_5.27_windows_intelx86.exe and upload it to the server side.

so can any one tell me what happend? is there anything in the config.xml need to be set? thanks your guys a lot.
4) Message boards : API : can any one help me? (Message 21461)
Posted 23 Nov 2008 by lanye
Post:
i followed the uc2_graphics.cpp example and now i can show the background and the 3D part. but the text part which i need is still not avalibale. can any one help me? thanks a lot. i will put my code here:


#ifdef _WIN32
#include "boinc_win.h"
#include "util.h" // parse_command_line(), boinc_sleep(), dtime()...
#include "str_util.h" // parse_command_line()
#endif

/* BOINC API */

#include "diagnostics.h"
#include "boinc_api.h"
#include "filesys.h"
#include "gutil.h"
#include "graphics2.h"
#include "boinc_gl.h"
#include "txf_util.h"
#include "uc2.h"


#include "version.h"
//#pragma comment(lib,"opengl32.lib")

/* Graphics header files */

#ifdef BOINC_APP_GRAPHICS
# if defined _WIN32 /* Windows */
# include <gl\glut.h>
# elif defined __APPLE_CC__ /* MacOS X */
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# include <GLUT/glut.h>
# else /* Unix */
# include <GL/gl.h>
# endif
# include "graphics_api.h" /* General graphics API for BOINC */
#endif




APP_INIT_DATA uc_aid;
float color[4] = {.7, .2, .5, 1};
TEXTURE_DESC logo;
int width, height;
UC_SHMEM* shmem = NULL;
float white[4] = {1,1, 1, 1};
double pitch_angle, roll_angle, viewpoint_distance=10;





static void parse_project_prefs(char* buf) {
char cs[256];
COLOR c;
double hue;
double max_frames_sec, max_gfx_cpu_pct;
if (!buf) return;
if (parse_str(buf, "<color_scheme>", cs, 256)) {
if (!strcmp(cs, "Tahiti Sunset")) {
hue = .9;
} else if (!strcmp(cs, "Desert Sands")) {
hue = .1;
} else {
hue = .5;
}
HLStoRGB(hue, .5, .5, c);
color[0] = c.r;
color[1] = c.g;
color[2] = c.b;
color[3] = 1;
}
if (parse_double(buf, "<max_frames_sec>", max_frames_sec)) {
boinc_max_fps = max_frames_sec;
}
if (parse_double(buf, "<max_gfx_cpu_pct>", max_gfx_cpu_pct)) {
boinc_max_gfx_cpu_frac = max_gfx_cpu_pct/100;
}
}


static void init_lights() {
GLfloat ambient[] = {1., 1., 1., 1.0};
GLfloat position[] = {-13.0, 6.0, 20.0, 1.0};
GLfloat dir[] = {-1, -.5, -3, 1.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_POSITION, position);
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir);
}

static void draw_logo() {
if (logo.present) {
float pos[3] = {.2, .3, 0};
float size[3] = {.6, .4, 0};
logo.draw(pos, size, ALIGN_CENTER, ALIGN_CENTER);
}
}



static void draw_text() {
static float x=0, y=0;
static float dx=0.0003, dy=0.0007;
char buf[256];
x += dx;
y += dy;
if (x < 0 || x > .5) dx *= -1;
if (y < 0 || y > .5) dy *= -1;
double fd = 0, cpu=0, dt;
/*if (shmem) {
fd = shmem->fraction_done;
cpu = shmem->cpu_time;
}*/
sprintf(buf, "User:");
txf_render_string(.1, x, y, 0, 500, white, 0, buf);
sprintf(buf, "Team:");
txf_render_string(.1, x, y+.1, 0, 500, white, 0, buf);
sprintf(buf, "%% Done:");
txf_render_string(.1, x, y+.2, 0, 500, white, 0, buf);
sprintf(buf, "CPU time: ");
txf_render_string(.1, x, y+.3, 0, 500, white, 0, buf);
/*if (shmem) {
dt = dtime() - shmem->update_time;
if (dt > 10) {
boinc_close_window_and_quit();
} else if (dt > 5) {
txf_render_string(.1, 0, 0, 0, 500, white, 0, "App not running - exiting in 5 seconds");
} else if (shmem->status.suspended) {
txf_render_string(.1, 0, 0, 0, 500, white, 0, "App suspended");
}
} else {
txf_render_string(.1, 0, 0, 0, 500, white, 0, "No shared mem");
}*/
}


static void draw_3d_stuff() {
static float x=0, y=0, z=10;
static float dx=0.3, dy=0.2, dz=0.5;
x += dx;
y += dy;
z += dz;
if (x < -15 || x > 15) dx *= -1;
if (y < -15 || y > 15) dy *= -1;
if (z < 0 || z > 40) dz *= -1;
float pos[3];
pos[0] = x;
pos[1] = y;
pos[2] = z;
drawSphere(pos, 4);
drawCylinder(false, pos, 6, 6);
}


void set_viewpoint(double dist) {
double x, y, z;
x = 0;
y = 3.0*dist;
z = 11.0*dist;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(
x, y, z, // eye position
0,-.8,0, // where we're looking
0.0, 1.0, 0. // up is in positive Y direction
);
glRotated(pitch_angle, 1., 0., 0);
glRotated(roll_angle, 0., 1., 0);
}

static void init_camera(double dist) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(
45.0, // field of view in degree
1.0, // aspect ratio
1.0, // Z near clip
1000.0 // Z far
);
set_viewpoint(dist);
}


//----------------------------------
int main(int argc, char **argv) {

boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS);

#ifdef __APPLE__
setMacIcon(argv[0], MacAppIconData, sizeof(MacAppIconData));
#endif

boinc_parse_init_data_file();
boinc_get_init_data(uc_aid);



if (uc_aid.project_preferences) {
parse_project_prefs(uc_aid.project_preferences);
}

boinc_graphics_loop(argc, argv);
boinc_finish_diag();

}




#ifdef BOINC_APP_GRAPHICS


/* What to do when the window gets resized. */

void app_graphics_resize(int w, int h){
fprintf(stderr,"GFX: app_graphics_resize(%d, %d) called. \n",
w, h);
width = w;
height = h;
glViewport(0, 0, w, h);
}


/* Initialization of the graphics */

void app_graphics_init() {


char path[256];

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

txf_load_fonts(".");
boinc_resolve_filename("logo.jpg", path, sizeof(path));
logo.load_image_file(path);
init_lights();

fprintf(stderr,"GFX: app_graphics_init() called. \n");

//glClearColor(0.0f, 255.0f, 0.0f, 0.0f); // Green Flash ;-)
// glClearDepth(1.0f); // Depth Buffer Setup
//glEnable(GL_DEPTH_TEST); // Enables Depth Testing
//glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing
}



/* app_graphics_render() draws whatever is to appear on the screen */

void app_graphics_render(int xs, int ys, double time_of_day) {

/*if (shmem == NULL) {
shmem = (UC_SHMEM*)boinc_graphics_get_shmem("uppercase");
}

if (shmem) {
shmem->countdown = 5;
}*/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mode_unshaded();
mode_ortho();
draw_logo();
ortho_done();


init_camera(viewpoint_distance);
scale_screen(width, height);
mode_shaded(color);
draw_3d_stuff();

mode_unshaded();
mode_ortho();
draw_text();
ortho_done();


/*glClearColor(255.0, 255.0, 0.0, 0.0); // Yellow screen of life
//fprintf(stderr,"GFX: app_graphics_render() called. \n");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glFlush();*/
}


#else // BOINC_APP_GRAPHICS


/* If no graphics then we have to still provide empty callbacks */

void app_graphics_init() {}
void app_graphics_render(int xs, int ys, double time_of_day) {}
void app_graphics_resize(int width, int height){}

#endif


/************************************
* These are empty for now in any case, but you need something there
*/

/* What to do if the preferences have been reset */

void app_graphics_reread_prefs() {}


/* What do do if the mouse is moved: */

void boinc_app_mouse_move(int x, int y, // new coords of cursor
int left, // whether buttons are down
int middle,
int right
){}

/* What to do if a mouse button is pressed */

void boinc_app_mouse_button(int x, int y, // coords of cursor
int which, // which button (0/1/2)
int is_down // true iff button is now down
){}

/* What to do if keyboard key is pressed */

void boinc_app_key_press(int, int // platform-specific key encodings!
){}

/* What to do if keyboard key is released */

void boinc_app_key_release(int, int // platform-specific key encodings!
){}

5) Message boards : API : what is COLOR? (Message 21458)
Posted 23 Nov 2008 by lanye
Post:
when i was reading the example uc2_graphics.cpp, i found a struct "COLOR" in the function "parse_project_prefs". can any one tell me where is this struct include?
if i want to compile uc2_graphics.cpp, what head file or some lib should i include in to the project?

thanks a lot
6) Message boards : API : how to find windows (Message 21409)
Posted 20 Nov 2008 by lanye
Post:
can any one tell me how to find the file win_config.h and version.h?
7) Message boards : API : can boinc app visit local system? (Message 21213)
Posted 13 Nov 2008 by lanye
Post:
i want to create a boinc application to visit the local OS. such as visit the windows register to get some information and give a MessageBox to the local user.

and i write an application as usual c++ application. the application works well in local machine. but when i put it on the boinc server ( i download the image form the web), the application can be download in the boinc client and executed. but the messagebox do not appear.

i do not know is this the application problem or some options in the config.xml need to be set( i create the app use the uppercase).

can any one tell me ? thanks a lot!
8) Message boards : API : how to put the windows application on the unix server? (Message 21176)
Posted 9 Nov 2008 by lanye
Post:
i use VMware to run the image downloaded form the page. and now i can compile my windows application on my XP system. and now i get a application named "hello_5.11_windows_intelx86.exe".
but the question now is how can i put it on the unix server and make the windows client run it. i tried:

http://boinc.berkeley.edu/trac/wiki/QuickStart

but it seems doesn't work. it gives the error report:

2008-11-9 20:00:35|yao|Message from server: No work sent
2008-11-9 20:00:35|yao|Message from server: upperCASE is not available for your type of computer.

can any one tell me what should i do? thanks a lot.
9) Message boards : API : how to build a boinc windows application? (Message 21169)
Posted 8 Nov 2008 by lanye
Post:
i want to write a windows application which is stored on the unix server and can be download to a windows machine. i checked out the boinc files. but no idea how can i use them.

can any one tell me how to build up such a appliction and debug it with vc++ 2005. even just a hello world applicaiton.

thanks a lot!
10) Message boards : API : does check out have some problem? (Message 21168)
Posted 8 Nov 2008 by lanye
Post:
i checked out the boinc and want to build some application on the windows platform. but when i comile win_build with vc++2005. the BOINCBaseView.cpp file seems have some problem.

there are several hundred of lines look like this:

strEncodedHtml.Replace(wxT("?), wxT("&Scaron;"), true);
strEncodedHtml.Replace(wxT("?), wxT("&OElig;"), true);
strEncodedHtml.Replace(wxT("?), wxT("&lsquo;"), true);

seems that there is a " missed behind the wxT"?) and i compared with the file form the web-based interface, i find the content in " " changed form some thing like Æ to ? and " missed. is this the problem of the check out application or the problem of the system?
i use TortoiseSVN for checking out and my system is windows XP. can any one help me? thanks very much!
11) Message boards : API : can anyone tell me how to use win_build? (Message 21159)
Posted 7 Nov 2008 by lanye
Post:
i need to make a boinc program running on windows OS. and i have no idea how to use the win_build. i want to follow the tutorial. but i can not find the simples.sln file in the win_build directory. can any one help me? please tell me how to use win_build. thanks a lot.




Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.