/** * This method does the drawing by calling the list of actors to draw themselfs */ void GLActorCollection::draw(bool picking)const { if (!isVisible()) return; OpenGLError::check("GLActorCollection::draw(0)"); size_t i = picking ? 1 : 0; if (m_useDisplayList[i]) { glCallList(m_displayListId[i]); } else if (m_displayListId[i] == 0) { m_displayListId[i] = glGenLists(1); // child actors can also create display lists, so delay // until all the children have finished making theirs drawGL(picking); } else { m_useDisplayList[i] = true; glNewList(m_displayListId[i], GL_COMPILE); //Construct display list for object representation drawGL(picking); glEndList(); if (glGetError() == GL_OUT_OF_MEMORY) //Throw an exception throw Mantid::Kernel::Exception::OpenGLError("OpenGL: Out of video memory"); glCallList(m_displayListId[i]); } OpenGLError::check("GLActorCollection::draw()"); }
UGL_LOCAL void loopEvent(void) { UGL_EVENT event; UGL_INPUT_EVENT * pInputEvent; drawGL(); UGL_FOREVER { if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER) != UGL_STATUS_Q_EMPTY) { pInputEvent = (UGL_INPUT_EVENT *)&event; if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD && pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN) { readKey(pInputEvent->type.keyboard.key); drawGL(); } } if (stopWex) break; } }
void cone::draw() { switch(draw_type) { case M_XWINDOWS: break; case M_OPENGL: drawGL(); break; default: break; } }
static void mainLoop () { SDL_Event event; int done = 0; int lastTicks = -1; int nowTicks; int delta = 0; while ( !done ) { if (lastTicks > 0) { nowTicks = SDL_GetTicks(); delta = nowTicks-lastTicks; lastTicks = nowTicks; } else { lastTicks = SDL_GetTicks(); } /* Check for events */ while ( SDL_PollEvent (&event) ) { switch (event.type) { case SDL_MOUSEMOTION: gravity.mouseMoved(event); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: gravity.mouseButton(event); break; case SDL_KEYDOWN: gravity.keyDown(event); if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod & KMOD_LMETA || event.key.keysym.mod & KMOD_RMETA)) { done = 1; } break; case SDL_KEYUP: gravity.keyUp(event); break; case SDL_QUIT: done = 1; break; default: break; } } gravity.update(delta); SDL_Delay(10); drawGL(); SDL_GL_SwapBuffers(); } }
INT WINAPI WinMain(HINSTANCE hCI, HINSTANCE hPI, LPSTR cmdstr, int cmdval) { globals.inst = hCI; globals.log = fopen("gl4.log", "w"); globals.draw = false; initWnd(); if(globals.wnd) globals.run = true; while(globals.run) { MSG msg; if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if(globals.draw) drawGL(); } fclose(globals.log); return 0; }
void CglWnd::OnTimer( UINT_PTR nIDEvent ) { if (m_bActive && nIDEvent == TIMER_DRAW) { drawGL(); } else if (nIDEvent == TIMER_PTS) { WCHAR buf[100]; //wsprintf(buf, L"FPS:%d ", g_fps_count); //SetWindowText(buf); wsprintf(buf, L"FPS:%d \n", g_fps_count); wprintf(buf); g_fps_count = 0; } else if (m_bActive && nIDEvent == TIMER_ACC) { updateBubblesF(); } }
void GdvCanvas3D::paintGL() { emit drawGL(); }
int processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData) { int handled = 1; int cursor; int visibility; GHOST_TEventKeyData *keyData = NULL; GHOST_TEventWheelData *wheelData = NULL; GHOST_DisplaySetting setting; GHOST_WindowHandle window = GHOST_GetEventWindow(hEvent); switch (GHOST_GetEventType(hEvent)) { #if 0 case GHOST_kEventUnknown: break; case GHOST_kEventCursorButton: break; case GHOST_kEventCursorMove: break; #endif case GHOST_kEventWheel: { wheelData = (GHOST_TEventWheelData *)GHOST_GetEventData(hEvent); if (wheelData->z > 0) { view_rotz += 5.f; } else { view_rotz -= 5.f; } } break; case GHOST_kEventKeyUp: break; case GHOST_kEventKeyDown: { keyData = (GHOST_TEventKeyData *)GHOST_GetEventData(hEvent); switch (keyData->key) { case GHOST_kKeyC: { cursor = sCursor; cursor++; if (cursor >= GHOST_kStandardCursorNumCursors) { cursor = GHOST_kStandardCursorFirstCursor; } sCursor = (GHOST_TStandardCursor)cursor; GHOST_SetCursorShape(window, sCursor); } break; case GHOST_kKeyF: if (!GHOST_GetFullScreen(shSystem)) { /* Begin fullscreen mode */ setting.bpp = 24; setting.frequency = 85; setting.xPixels = 640; setting.yPixels = 480; /* * setting.bpp = 16; * setting.frequency = 75; * setting.xPixels = 640; * setting.yPixels = 480; */ sFullScreenWindow = GHOST_BeginFullScreen(shSystem, &setting, FALSE /* stereo flag */); } else { GHOST_EndFullScreen(shSystem); sFullScreenWindow = 0; } break; case GHOST_kKeyH: { visibility = GHOST_GetCursorVisibility(window); GHOST_SetCursorVisibility(window, !visibility); } break; case GHOST_kKeyQ: if (GHOST_GetFullScreen(shSystem)) { GHOST_EndFullScreen(shSystem); sFullScreenWindow = 0; } sExitRequested = 1; case GHOST_kKeyT: if (!sTestTimer) { sTestTimer = GHOST_InstallTimer(shSystem, 0, 1000, testTimerProc, NULL); } else { GHOST_RemoveTimer(shSystem, sTestTimer); sTestTimer = 0; } break; case GHOST_kKeyW: { if (sMainWindow) { char *title = GHOST_GetTitle(sMainWindow); char *ntitle = malloc(strlen(title) + 2); sprintf(ntitle, "%s-", title); GHOST_SetTitle(sMainWindow, ntitle); free(ntitle); free(title); } } break; default: break; } } break; case GHOST_kEventWindowClose: { GHOST_WindowHandle window2 = GHOST_GetEventWindow(hEvent); if (window2 == sMainWindow) { sExitRequested = 1; } else { if (sGearsTimer) { GHOST_RemoveTimer(shSystem, sGearsTimer); sGearsTimer = 0; } GHOST_DisposeWindow(shSystem, window2); } } break; case GHOST_kEventWindowActivate: handled = 0; break; case GHOST_kEventWindowDeactivate: handled = 0; break; case GHOST_kEventWindowUpdate: { GHOST_WindowHandle window2 = GHOST_GetEventWindow(hEvent); if (!GHOST_ValidWindow(shSystem, window2)) break; setViewPortGL(window2); drawGL(); GHOST_SwapWindowBuffers(window2); } break; default: handled = 0; break; } return handled; }
void Body::drawGL() { FOR_ALL_LIMBS(drawGL()); }