void POIsImageWidget::paintEvent(QPaintEvent *paintEvent) { //--- Make this widget the current context for OpenGL drawing makeCurrent(); //Save current state, QPainter modifies MODELVIEW matrix. glMatrixMode(GL_MODELVIEW); glPushMatrix(); setupViewPort(width(), height()); glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT); glLoadIdentity(); drawBackgroundImage(); //Restore state after drawing pure openGL glMatrixMode(GL_MODELVIEW); glPopMatrix(); QPainter painter; painter.begin(this); drawPOIs(&painter); painter.end(); //--- Set OpenGL drawing context to no area doneCurrent(); }
void LetterHunter::render(float timeDelta) { // Create device dependent resources d2d_->createDeviceResources(hwnd_); // Get Hwnd render target ID2D1HwndRenderTarget* rendertarget = d2d_->getD2DHwndRenderTarget(); // Update text object before rendering update(timeDelta); rendertarget->BeginDraw(); // Set render target background color to white rendertarget->Clear(D2D1::ColorF(D2D1::ColorF::White)); // render background image wchar_t* imageFile = L"./Media/Picture/Fairy_of_the_Water.jpg"; drawBackgroundImage(imageFile); // render text objects for(unsigned int i = 0; i < textBuffer_.size(); ++i) { if(textBuffer_[i]->isLive()) { textBuffer_[i]->render(); } } // render bullet objects for(unsigned int i = 0; i < bulletBuffer_.size(); ++i) { if(bulletBuffer_[i]->isLive()) { bulletBuffer_[i]->render(); } } // render score score_->draw(); rendertarget->EndDraw(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackgroundGradient(ofColor::cyan, ofColor::purple); drawBackgroundImage(); drawData(); }