mirror of https://github.com/BOINC/boinc.git
windows/astropulse graphics
svn path=/trunk/boinc/; revision=878
This commit is contained in:
parent
37f1bfe05c
commit
52935e6e03
|
@ -447,6 +447,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
|
||||||
|
|
||||||
DWORD WINAPI win_graphics_event_loop( LPVOID gi ) {
|
DWORD WINAPI win_graphics_event_loop( LPVOID gi ) {
|
||||||
MSG msg; // Windows Message Structure
|
MSG msg; // Windows Message Structure
|
||||||
|
clock_t next_redraw=0;
|
||||||
|
GRAPHICS_INFO gfx_info = *(GRAPHICS_INFO*)gi;
|
||||||
|
|
||||||
fullscreen=FALSE; // Windowed Mode
|
fullscreen=FALSE; // Windowed Mode
|
||||||
|
|
||||||
|
@ -455,30 +457,29 @@ DWORD WINAPI win_graphics_event_loop( LPVOID gi ) {
|
||||||
BOINC_GFX_MODE_MSG = RegisterWindowMessage( "BOINC_GFX_MODE" );
|
BOINC_GFX_MODE_MSG = RegisterWindowMessage( "BOINC_GFX_MODE" );
|
||||||
|
|
||||||
// Create Our OpenGL Window
|
// Create Our OpenGL Window
|
||||||
if (!CreateGLWindow("BOINC App Window",((GRAPHICS_INFO*)gi)->xsize,
|
if (!CreateGLWindow("BOINC App Window",gfx_info.xsize,
|
||||||
((GRAPHICS_INFO*)gi)->ysize,16,false)) {
|
gfx_info.ysize,16,false)) {
|
||||||
return -1; // Quit this thread if window was not created
|
return -1; // Quit this thread if window was not created
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the graphics refresh timer
|
// Initialize the graphics refresh timer
|
||||||
gfx_timer = SetTimer(NULL, GFX_TIMER_ID,
|
gfx_timer = SetTimer(NULL, GFX_TIMER_ID, (int)(gfx_info.refresh_period*1000),
|
||||||
(int)(((GRAPHICS_INFO*)gi)->refresh_period*1000),
|
|
||||||
(TIMERPROC)NULL);
|
(TIMERPROC)NULL);
|
||||||
cur_gfx_mode = MODE_NO_GRAPHICS;
|
cur_gfx_mode = MODE_NO_GRAPHICS;
|
||||||
using_opengl = true;
|
using_opengl = true;
|
||||||
ChangeMode(MODE_WINDOW);
|
|
||||||
|
|
||||||
while(!win_loop_done) // Loop That Runs While done=FALSE
|
while(!win_loop_done) // Loop That Runs While done=FALSE
|
||||||
{
|
{
|
||||||
if (GetMessage(&msg,NULL,0,0)) { // Is There A Message Waiting?
|
if (GetMessage(&msg,NULL,0,0)) { // Is There A Message Waiting?
|
||||||
if (msg.message==WM_TIMER) {
|
if (msg.message==WM_TIMER) {
|
||||||
if (active) { // only draw if the window is visible
|
if (active && (clock() > next_redraw)) { // only draw if the window is visible and enough time has passed
|
||||||
// Draw The Scene
|
// Draw The Scene
|
||||||
RECT win_rect;
|
RECT win_rect;
|
||||||
GetWindowRect(hWnd,&win_rect);
|
GetWindowRect(hWnd,&win_rect);
|
||||||
app_render(win_rect.right-win_rect.left,win_rect.bottom-win_rect.top,
|
app_render(win_rect.right-win_rect.left,win_rect.bottom-win_rect.top,
|
||||||
time(NULL));
|
time(NULL));
|
||||||
SwapBuffers(hDC); // This seems to take lots of CPU time
|
SwapBuffers(hDC); // This seems to take lots of CPU time
|
||||||
|
next_redraw = clock()+(int)(gfx_info.refresh_period*CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TranslateMessage(&msg); // Translate The Message
|
TranslateMessage(&msg); // Translate The Message
|
||||||
|
|
Loading…
Reference in New Issue