mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4325
This commit is contained in:
parent
6501a9e4dd
commit
b531e42fa9
|
@ -60,16 +60,24 @@ HANDLE hQuitEvent;
|
|||
|
||||
bool graphics_inited = false;
|
||||
|
||||
static void (*worker_main)();
|
||||
|
||||
#ifdef _WIN32
|
||||
// glue routine for Windows
|
||||
DWORD WINAPI foobar(LPVOID foo) {
|
||||
void (*w)() = (void (*)()) foo;
|
||||
w();
|
||||
DWORD WINAPI foobar(LPVOID) {
|
||||
worker_main();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef _PTHREAD_H
|
||||
void* foobar(void*) {
|
||||
worker_main();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int boinc_init_graphics(void (*worker_main)()) {
|
||||
int boinc_init_graphics(void (*_worker_main)()) {
|
||||
worker_main = _worker_main;
|
||||
#ifdef _WIN32
|
||||
|
||||
// Create the event object used to signal between the
|
||||
|
@ -88,7 +96,7 @@ int boinc_init_graphics(void (*worker_main)()) {
|
|||
// TODO: is it better to use _beginthreadex here?
|
||||
//
|
||||
worker_threadh = CreateThread(
|
||||
NULL, 0, foobar, worker_main, CREATE_SUSPENDED, &threadId
|
||||
NULL, 0, foobar, 0, CREATE_SUSPENDED, &threadId
|
||||
);
|
||||
|
||||
// raise priority of graphics thread (i.e. current thread)
|
||||
|
@ -134,9 +142,10 @@ int boinc_init_graphics(void (*worker_main)()) {
|
|||
#ifdef _PTHREAD_H
|
||||
pthread_t worker_thread;
|
||||
pthread_attr_t worker_thread_attr;
|
||||
int retval;
|
||||
|
||||
pthread_attr_init( &worker_thread_attr );
|
||||
retval = pthread_create( &worker_thread, &worker_thread_attr, worker_main, &gi );
|
||||
retval = pthread_create( &worker_thread, &worker_thread_attr, foobar, 0 );
|
||||
if (retval) return ERR_THREAD;
|
||||
pthread_attr_destroy( &worker_thread_attr );
|
||||
graphics_inited = true;
|
||||
|
|
|
@ -33,7 +33,6 @@ struct COLOR {
|
|||
|
||||
extern void HLStoRGB( double H, double L, double S, COLOR& c);
|
||||
|
||||
static float frand();
|
||||
extern void scale_screen(int w,int h);
|
||||
extern void center_screen(int w,int h);
|
||||
|
||||
|
|
15
api/reduce.C
15
api/reduce.C
|
@ -360,8 +360,8 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
|
|||
glEnd();
|
||||
|
||||
|
||||
#if 0
|
||||
//draw lines
|
||||
/*
|
||||
mode_unshaded();
|
||||
glLineWidth(.5f);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -386,7 +386,6 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
|
|||
|
||||
glVertex3f(x0, y1, z0);
|
||||
glVertex3f(x1, y1, z0);
|
||||
/*
|
||||
//back
|
||||
glVertex3f(x0, y0, z1);
|
||||
glVertex3f(x0, y1, z1);
|
||||
|
@ -423,8 +422,8 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
|
|||
|
||||
glVertex3f(x1, y0, z1);
|
||||
glVertex3f(x1, y0, z0);
|
||||
*/
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
glEnd();
|
||||
break;
|
||||
case GRAPH_STYLE_SURFACE:
|
||||
|
@ -584,7 +583,7 @@ void REDUCED_ARRAY::draw_row_rect_y(int row) {
|
|||
|
||||
// draw a black line on top of rectangle
|
||||
//
|
||||
/*
|
||||
#if 0
|
||||
glBegin(GL_LINES);
|
||||
glColor4f(0., 0., 0., 1.0);
|
||||
for (i=0; i<rdimx-1; i++) {
|
||||
|
@ -597,7 +596,7 @@ void REDUCED_ARRAY::draw_row_rect_y(int row) {
|
|||
glVertex3f(x0, y1, z1);
|
||||
}
|
||||
glEnd();
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,9 +654,11 @@ void REDUCED_ARRAY::draw_axis_labels() {
|
|||
float w;
|
||||
|
||||
char* x_label = "Time";
|
||||
#if 0
|
||||
char* y_label = "Frequency";
|
||||
char* y_begin_label = "0";
|
||||
char* y_end_label = "9 Khz";
|
||||
#endif
|
||||
|
||||
float x_text_pos[3] = {0,0,0};
|
||||
w = text_width(x_label);
|
||||
|
@ -778,6 +779,7 @@ void REDUCED_ARRAY::draw_labels() {
|
|||
float lw = .02f;
|
||||
float ls = 0;
|
||||
|
||||
#if 0
|
||||
float wd=.015f;
|
||||
float l=1.0f;
|
||||
|
||||
|
@ -785,6 +787,7 @@ void REDUCED_ARRAY::draw_labels() {
|
|||
float left_of_z2 = -0.04f;
|
||||
float below_x = -.03f;
|
||||
float center_x = -.06f;
|
||||
#endif
|
||||
|
||||
glLineWidth(1.4f);
|
||||
glBegin(GL_LINES);
|
||||
|
|
|
@ -11,16 +11,17 @@
|
|||
|
||||
#define BOINC_WINDOW_CLASS_NAME "BOINC_app"
|
||||
|
||||
#define TIMER_INTERVAL_MSEC 30
|
||||
|
||||
static bool visible = true;
|
||||
static int current_graphics_mode = MODE_HIDE_GRAPHICS;
|
||||
static int acked_graphics_mode;
|
||||
static int xpos = 100, ypos = 100;
|
||||
static int clicked_button;
|
||||
static int win=0;
|
||||
static extern int userclose;
|
||||
extern int userclose;
|
||||
extern void graphics_thread_init();
|
||||
//extern GRAPHICS_INFO gi;
|
||||
static void timer_handler();
|
||||
static void set_mode(int mode);
|
||||
|
||||
void keyboardU(unsigned char key, int x, int y) {
|
||||
|
@ -82,11 +83,30 @@ void onIdle(){
|
|||
}
|
||||
#endif
|
||||
|
||||
static void maybe_render() {
|
||||
int width, height;
|
||||
if (visible && (current_graphics_mode != MODE_HIDE_GRAPHICS)) {
|
||||
width = glutGet(GLUT_WINDOW_WIDTH);
|
||||
height = glutGet(GLUT_WINDOW_HEIGHT);
|
||||
if (throttled_app_render(width, height, dtime())) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void close_func() {
|
||||
if (boinc_is_standalone()) {
|
||||
exit(0);
|
||||
} else {
|
||||
set_mode(MODE_HIDE_GRAPHICS);
|
||||
}
|
||||
}
|
||||
|
||||
static void make_new_window(int mode){
|
||||
if (mode == MODE_WINDOW || mode == MODE_FULLSCREEN){
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
|
||||
glutInitWindowPosition(xpos, ypos);
|
||||
glutInitWindowSize(gi.xsize, gi.ysize);
|
||||
glutInitWindowSize(600, 400);
|
||||
boinc_get_init_data(aid);
|
||||
if (!strlen(aid.app_name)) {
|
||||
strcpy(aid.app_name, "BOINC Application");
|
||||
|
@ -97,9 +117,8 @@ static void make_new_window(int mode){
|
|||
glutKeyboardUpFunc(keyboardU);
|
||||
glutMouseFunc(mouse_click);
|
||||
glutMotionFunc(mouse_click_move);
|
||||
glutDisplayFunc(timer_handler);
|
||||
//glutIdleFunc(onIdle);
|
||||
glutTimerFunc(30,
|
||||
//glutCloseFunc(close_func);
|
||||
glutDisplayFunc(maybe_render);
|
||||
|
||||
app_graphics_init();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
@ -131,21 +150,13 @@ void set_mode(int mode) {
|
|||
}
|
||||
}
|
||||
|
||||
void* xwin_graphics_event_loop(void*){
|
||||
if (boinc_is_standalone()) {
|
||||
set_mode(MODE_WINDOW);
|
||||
} else {
|
||||
set_mode(MODE_HIDE_GRAPHICS);
|
||||
}
|
||||
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void timer_handler(int) {
|
||||
char buf[MSG_CHANNEL_SIZE];
|
||||
|
||||
int width, height, new_mode;
|
||||
if (userclose) {
|
||||
close_func();
|
||||
}
|
||||
int new_mode;
|
||||
if (app_client_shm) {
|
||||
if (app_client_shm->shm->graphics_request.get_msg(buf)) {
|
||||
new_mode = app_client_shm->decode_graphics_msg(buf);
|
||||
|
@ -175,12 +186,17 @@ static void timer_handler(int) {
|
|||
if (sent) acked_graphics_mode = current_graphics_mode;
|
||||
}
|
||||
}
|
||||
if (visible && (current_graphics_mode != MODE_HIDE_GRAPHICS) {
|
||||
width = glutGet(GLUT_WINDOW_WIDTH);
|
||||
height = glutGet(GLUT_WINDOW_HEIGHT);
|
||||
if (throttled_app_render(width, height, dtime())) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
maybe_render();
|
||||
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
|
||||
}
|
||||
|
||||
void xwin_graphics_event_loop(){
|
||||
if (boinc_is_standalone()) {
|
||||
set_mode(MODE_WINDOW);
|
||||
} else {
|
||||
set_mode(MODE_HIDE_GRAPHICS);
|
||||
}
|
||||
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
|
||||
glutMainLoop();
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
extern void *xwin_graphics_event_loop( void * );
|
||||
extern void xwin_graphics_event_loop();
|
||||
|
|
|
@ -12,8 +12,9 @@ libapp_a_SOURCES = \
|
|||
../lib/app_ipc.C \
|
||||
../lib/diagnostics.C \
|
||||
../lib/diagnostics.h \
|
||||
../lib/filesys.C \
|
||||
../lib/parse.C \
|
||||
../lib/proxy.C \
|
||||
../lib/prefs.C \
|
||||
../lib/shmem.C \
|
||||
../lib/util.C
|
||||
|
||||
|
|
|
@ -18330,8 +18330,8 @@ David 12 Oct 2004
|
|||
wingui_mainwindow.cpp
|
||||
|
||||
David 13 Oct 2004
|
||||
- in global prefs XML, if cpu_scheduling_period_minutes is empty, set it to 60
|
||||
(this caused core client to hang in some situations)
|
||||
- in global prefs XML, if cpu_scheduling_period_minutes is empty,
|
||||
set it to 60 (this caused core client to hang in some situations)
|
||||
- renamed PREFS::cpu_sched_period to cpu_scheduling_period_minutes
|
||||
(matching what it's called in the XML)
|
||||
|
||||
|
@ -18353,3 +18353,13 @@ Lana 13 Oct 2004
|
|||
sched/
|
||||
validator.C
|
||||
|
||||
David 13 Oct 2004
|
||||
- Get app graphics working in Linux
|
||||
|
||||
api/
|
||||
graphics_api.C
|
||||
gutil.h
|
||||
reduce.C
|
||||
x_opengl.C,h
|
||||
apps/
|
||||
Makefile.am
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CXX = $(shell wx-config --cxx)
|
||||
|
||||
CFLAGS = -I ../lib
|
||||
CFLAGS = -g -I ../lib
|
||||
|
||||
PROGRAM = boinc_gui
|
||||
|
||||
|
|
Loading…
Reference in New Issue