static void Display(void) { FrameCount++; uint64_t uiStartTime = GetCurrentTime(); glClear (GL_COLOR_BUFFER_BIT); int err = Recompute(); if (err != 0) { printf("Error %d from Recompute!\n", err); exit(1); } RenderTexture(HostImageBuffer); ReportInfo(); glFinish(); // for timing uint64_t uiEndTime = GetCurrentTime(); ReportStats(uiStartTime, uiEndTime); glutSwapBuffers(); glutPostRedisplay(); }
static void Display_(void) { FrameCount++; ExecutionCount++; uint64_t uiStartTime = GetCurrentTime(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT); if(Animated) { UpdateData(); UpdateVBOs(); } int err = Recompute(); if (err != 0) { printf("Error %d from Recompute!\n", err); exit(1); } if (EnableStideExec && ((ExecutionCount / ExecuteStride) % 2) == 0) { printf("CL only for frame %d\n", ExecutionCount); return; } glDrawArrays(GL_POINTS, 0, DataElemCount / 4); ReportInfo(); glFinish(); // for timing uint64_t uiEndTime = GetCurrentTime(); ReportStats(uiStartTime, uiEndTime); DrawText(TextOffset[0], TextOffset[1], 1, (Animated == 0) ? "Press space to animate" : " "); glutSwapBuffers(); }
BOOL CTrackDlg::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN) { int nChar = pMsg->wParam; if((nChar == 'Z') || (nChar == 'X')) { if((pMsg->lParam & 0xFFFF) == 1) { CString str; BOOL stepped = FALSE; if((nChar == 'Z') && (m_step != LEFT)) { m_step = LEFT; m_numSteps++; stepped = TRUE; } else if ((nChar == 'X') && (m_step != RIGHT)) { m_step = RIGHT; m_numSteps++; stepped = TRUE; } if(stepped && m_racing) { m_progress.SetPos(m_numSteps); if(m_numSteps == m_totalSteps) { DWORD diff; m_racing = FALSE; diff = (GetTickCount() - m_start); str.Format("%0.3fs\n", diff / 1000.0); OutputDebugString(str); MessageBox(str); UpdateData(); m_info = "DONE"; // Report the stats. //////////////////// ReportStats(diff); // Update best time(s) if needed. ///////////////////////////////// CString * topStr; CString * bestStr; DWORD topTime; DWORD bestTime; if(m_event == EVENT_50) { topStr = &m_top50; bestStr = &m_best50; } else if(m_event == EVENT_100) { topStr = &m_top100; bestStr = &m_best100; } else { topStr = &m_top200; bestStr = &m_best200; } topTime = (DWORD)(atof(*topStr) * 1000); bestTime = (DWORD)(atof(*bestStr) * 1000); if(!bestTime || (diff < bestTime)) { bestStr->Format("%0.3f", diff / 1000.0); if(diff < topTime) *topStr = *bestStr; } UpdateData(FALSE); m_event = EVENT_NONE; } } } return TRUE; } } return CDialog::PreTranslateMessage(pMsg); }