From 9a554f7eeca9fcd1d1e7efb6d2a328c3b3f20e3d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 9 Dec 2008 14:07:59 +0000 Subject: [PATCH] Fixed cull callback usage to ensure that the lazy updating of the browser image functions automatically. --- src/osgPlugins/gecko/UBrowser.cpp | 10 ++++++++-- src/osgPlugins/gecko/UBrowser.h | 2 +- src/osgWidget/Browser.cpp | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/gecko/UBrowser.cpp b/src/osgPlugins/gecko/UBrowser.cpp index a5b3e2311..9a59cbc97 100644 --- a/src/osgPlugins/gecko/UBrowser.cpp +++ b/src/osgPlugins/gecko/UBrowser.cpp @@ -240,11 +240,16 @@ struct UpdateOperation : public osg::Operation if (!image) return false; double deltaTime = image->getTimeOfLastRender() - image->getTimeOfLastUpdate(); + +// osg::notify(osg::NOTICE)<<"deltaTime = "<getTimeOfLastRender() = "<getTimeOfLastRender()<getTimeOfLastUpdate() = "<getTimeOfLastUpdate()<getBrowserWindowId(); if (id==0) @@ -283,6 +288,8 @@ struct UpdateOperation : public osg::Operation GLint internalFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_RGB : GL_RGBA; GLenum pixelFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_BGR_EXT : GL_BGRA_EXT; + // osg::notify(osg::NOTICE)<<" doing image update "<setImage(width,height,1, internalFormat, pixelFormat, GL_UNSIGNED_BYTE, (unsigned char*)LLMozLib::getInstance()->getBrowserWindowPixels( id ), osg::Image::NO_DELETE); @@ -599,7 +606,6 @@ bool UBrowserImage::sendKeyEvent(int key, bool keyDown) void UBrowserImage::setFrameLastRendered(const osg::FrameStamp*) { _timeOfLastRender = time(); - _manager->active(this); } diff --git a/src/osgPlugins/gecko/UBrowser.h b/src/osgPlugins/gecko/UBrowser.h index 97db55152..39ed099b7 100644 --- a/src/osgPlugins/gecko/UBrowser.h +++ b/src/osgPlugins/gecko/UBrowser.h @@ -152,7 +152,7 @@ class UBrowserImage : public osgWidget::BrowserImage, public LLEmbeddedBrowserWi // virtual void onStatusTextChange( const EventType& eventIn ) { - osg::notify(osg::NOTICE) << "Event: status updated to " << eventIn.getStringValue() << std::endl; + osg::notify(osg::INFO) << "Event: status updated to " << eventIn.getStringValue() << std::endl; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/osgWidget/Browser.cpp b/src/osgWidget/Browser.cpp index 37f670b42..3e62aba48 100644 --- a/src/osgWidget/Browser.cpp +++ b/src/osgWidget/Browser.cpp @@ -93,7 +93,10 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints) texture, osg::StateAttribute::ON); - pictureQuad->setEventCallback(new osgViewer::InteractiveImageHandler(_browserImage.get())); + osg::ref_ptr handler = new osgViewer::InteractiveImageHandler(_browserImage.get()); + + pictureQuad->setEventCallback(handler.get()); + pictureQuad->setCullCallback(handler.get()); addDrawable(pictureQuad);