From b531e42fa9a0b6d01eb4a34c1ba81a174e8b9ebb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 13 Oct 2004 22:52:37 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4325 --- api/graphics_api.C | 21 ++++++++++----- api/gutil.h | 1 - api/reduce.C | 15 ++++++----- api/x_opengl.C | 66 ++++++++++++++++++++++++++++------------------ api/x_opengl.h | 2 +- apps/Makefile.am | 3 ++- checkin_notes | 14 ++++++++-- clientgui/Makefile | 2 +- 8 files changed, 81 insertions(+), 43 deletions(-) diff --git a/api/graphics_api.C b/api/graphics_api.C index 9dcb466ae1..8950224de4 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -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; diff --git a/api/gutil.h b/api/gutil.h index c788b75f2e..4fb778ed2d 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -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); diff --git a/api/reduce.C b/api/reduce.C index 6ca54e33da..3ce889f320 100644 --- a/api/reduce.C +++ b/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; ishm->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(); +} + diff --git a/api/x_opengl.h b/api/x_opengl.h index 35871c36c5..e2e88a0f5c 100644 --- a/api/x_opengl.h +++ b/api/x_opengl.h @@ -1 +1 @@ -extern void *xwin_graphics_event_loop( void * ); +extern void xwin_graphics_event_loop(); diff --git a/apps/Makefile.am b/apps/Makefile.am index 7e9a9cc921..7eae483867 100644 --- a/apps/Makefile.am +++ b/apps/Makefile.am @@ -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 diff --git a/checkin_notes b/checkin_notes index a4d7abdea5..7013b5bfa4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/clientgui/Makefile b/clientgui/Makefile index 2b09b12ebb..fd57cebaf6 100644 --- a/clientgui/Makefile +++ b/clientgui/Makefile @@ -1,6 +1,6 @@ CXX = $(shell wx-config --cxx) -CFLAGS = -I ../lib +CFLAGS = -g -I ../lib PROGRAM = boinc_gui