/** * Draw another frame */ void FWRenderer::drawFrame() { drawBackground(); drawOverlays(); if (!_cmd.empty()) { drawCommand(); } if (_changePal) { refreshPalette(); } const int menus = _menuStack.size(); for (int i = 0; i < menus; ++i) _menuStack[i]->drawMenu(*this, (i == menus - 1)); blit(); }
//-------------------------------------------------------------- void testApp::draw(){ // what do we scale to? float scale = ofGetHeight()/frame.getHeight(); ofSetHexColor(0xFFFFFF); glPushMatrix(); { glScalef(scale, scale, 1); // scale to the size of the video scale = (float)frame.getWidth() / (float)videoFeed.getWidth(); float xx = ((float)videoFeed.getWidth() * (float)frame.getHeight()) / (float)frame.getWidth(); float yOff = (xx - videoFeed.getHeight())/2.f; glPushMatrix(); { glScalef(scale, scale, 1); glTranslatef(0, yOff, 0); dots.begin(); carousel.draw(); dots.end(); //videoFeed.draw(0, 0); drawOverlays(); } glPopMatrix(); glColor3f(1,1,1); frame.draw(0, 0); } glPopMatrix(); if(gui.isOn()) { gui.draw(); } }
void SkyMapQDraw::paintEvent( QPaintEvent *event ) { Q_UNUSED(event); // This is machinery to prevent multiple concurrent paint events / recursive paint events if( m_DrawLock ) { kDebug() << "I just prevented a recursive / concurrent draw!"; return; } setDrawLock( true ); calculateFPS(); //If computeSkymap is false, then we just refresh the window using the stored sky pixmap //and draw the "overlays" on top. This lets us update the overlay information rapidly //without needing to recompute the entire skymap. //use update() to trigger this "short" paint event; to force a full "recompute" //of the skymap, use forceUpdate(). if (!m_SkyMap->computeSkymap) { QPainter p; p.begin( this ); p.drawLine(0,0,1,1); // Dummy operation to circumvent bug. TODO: Add details p.drawPixmap( 0, 0, *m_SkyPixmap ); drawOverlays(p); p.end(); setDrawLock( false ); return ; // exit because the pixmap is repainted and that's all what we want } // FIXME: used to to notify infobox about possible change of object coordinates // Not elegant at all. Should find better option m_SkyMap->showFocusCoords(); m_SkyMap->setupProjector(); SkyQPainter psky(this, m_SkyPixmap); //FIXME: we may want to move this into the components. psky.begin(); //Draw all sky elements psky.drawSkyBackground(); m_KStarsData->skyComposite()->draw( &psky ); //Finish up psky.end(); QPainter psky2; psky2.begin( this ); psky2.drawLine(0,0,1,1); // Dummy op. psky2.drawPixmap( 0, 0, *m_SkyPixmap ); drawOverlays(psky2); psky2.end(); if(m_SkyMap->m_previewLegend) { m_SkyMap->m_legend.paintLegend(m_SkyPixmap); } m_SkyMap->computeSkymap = false; // use forceUpdate() to compute new skymap else old pixmap will be shown setDrawLock( false ); }