void ofxAwesomium::update(){ webCore->Update(); // Call our display func when the WebView needs rendering //if (webView->isDirty()) { //const Awesomium::RenderBuffer* renderBuffer = webView->render() Awesomium::BitmapSurface* surface = (Awesomium::BitmapSurface*)webView->surface(); if (surface) { webTex.loadData(surface->buffer(), webTexWidth, webTexHeight, GL_BGRA); } //} }
void SRPWindows::UpdateCall() { Awesomium::BitmapSurface* surface = static_cast<Awesomium::BitmapSurface*>(m_pWindow->surface()); if (surface) { if (surface->is_dirty()) { surface->CopyTo(m_cImage.GetBuffer()->GetData(), m_psWindowsData->nFrameWidth * 4, 4, false, false); surface->set_is_dirty(false); BufferUploadToGPU(); } } }
effVOID EFF3DHtmlWindow::Render() { if ( webView == NULL || texture == NULL ) { return; } /*if ( webView->IsLoading() ) { return; }*/ Awesomium::BitmapSurface * surface = (Awesomium::BitmapSurface *)webView->surface(); if ( surface != NULL /*&& surface->is_dirty()*/ ) { static bool runFirst = true; //if ( runFirst ) { surface->SaveToPNG(Awesomium::WSLit("11.png"), true); runFirst = false; } EFF3DLOCKED_RECT rc; if ( FAILED(texture->LockRect(0, &rc, NULL, EFF3DLOCK_DISCARD)) ) { return; } surface->CopyTo((unsigned char *)rc.pBits, rc.Pitch, 4, false, false); texture->Unlock(); } EFF3DDevice * device = EFF3DGetDevice(); device->SetRenderState(EFF3DRS_ALPHABLENDENABLE, effTRUE); device->SetRenderState(EFF3DRS_SRCBLEND, EFF3DBLEND_SRCALPHA); device->SetRenderState(EFF3DRS_DESTBLEND, EFF3DBLEND_INVSRCALPHA); device->DrawQuad(NULL, texture, effTRUE); device->SetRenderState(EFF3DRS_ALPHABLENDENABLE, effFALSE); }