Fixed cull callback usage to ensure that the lazy updating of the browser image functions automatically.
This commit is contained in:
parent
c8190d9c54
commit
9a554f7eec
@ -240,6 +240,11 @@ struct UpdateOperation : public osg::Operation
|
|||||||
if (!image) return false;
|
if (!image) return false;
|
||||||
|
|
||||||
double deltaTime = image->getTimeOfLastRender() - image->getTimeOfLastUpdate();
|
double deltaTime = image->getTimeOfLastRender() - image->getTimeOfLastUpdate();
|
||||||
|
|
||||||
|
// osg::notify(osg::NOTICE)<<"deltaTime = "<<deltaTime<<std::endl;
|
||||||
|
// osg::notify(osg::NOTICE)<<" image->getTimeOfLastRender() = "<<image->getTimeOfLastRender()<<std::endl;
|
||||||
|
// osg::notify(osg::NOTICE)<<" image->getTimeOfLastUpdate() = "<<image->getTimeOfLastUpdate()<<std::endl;
|
||||||
|
|
||||||
if (deltaTime<0.0)
|
if (deltaTime<0.0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -283,6 +288,8 @@ struct UpdateOperation : public osg::Operation
|
|||||||
GLint internalFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_RGB : GL_RGBA;
|
GLint internalFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_RGB : GL_RGBA;
|
||||||
GLenum pixelFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_BGR_EXT : GL_BGRA_EXT;
|
GLenum pixelFormat = LLMozLib::getInstance()->getBrowserDepth( id ) == 3 ? GL_BGR_EXT : GL_BGRA_EXT;
|
||||||
|
|
||||||
|
// osg::notify(osg::NOTICE)<<" doing image update "<<std::endl;
|
||||||
|
|
||||||
image->setImage(width,height,1, internalFormat, pixelFormat, GL_UNSIGNED_BYTE,
|
image->setImage(width,height,1, internalFormat, pixelFormat, GL_UNSIGNED_BYTE,
|
||||||
(unsigned char*)LLMozLib::getInstance()->getBrowserWindowPixels( id ),
|
(unsigned char*)LLMozLib::getInstance()->getBrowserWindowPixels( id ),
|
||||||
osg::Image::NO_DELETE);
|
osg::Image::NO_DELETE);
|
||||||
@ -599,7 +606,6 @@ bool UBrowserImage::sendKeyEvent(int key, bool keyDown)
|
|||||||
void UBrowserImage::setFrameLastRendered(const osg::FrameStamp*)
|
void UBrowserImage::setFrameLastRendered(const osg::FrameStamp*)
|
||||||
{
|
{
|
||||||
_timeOfLastRender = time();
|
_timeOfLastRender = time();
|
||||||
|
|
||||||
_manager->active(this);
|
_manager->active(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class UBrowserImage : public osgWidget::BrowserImage, public LLEmbeddedBrowserWi
|
|||||||
// virtual
|
// virtual
|
||||||
void onStatusTextChange( const EventType& eventIn )
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -93,7 +93,10 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints)
|
|||||||
texture,
|
texture,
|
||||||
osg::StateAttribute::ON);
|
osg::StateAttribute::ON);
|
||||||
|
|
||||||
pictureQuad->setEventCallback(new osgViewer::InteractiveImageHandler(_browserImage.get()));
|
osg::ref_ptr<osgViewer::InteractiveImageHandler> handler = new osgViewer::InteractiveImageHandler(_browserImage.get());
|
||||||
|
|
||||||
|
pictureQuad->setEventCallback(handler.get());
|
||||||
|
pictureQuad->setCullCallback(handler.get());
|
||||||
|
|
||||||
addDrawable(pictureQuad);
|
addDrawable(pictureQuad);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user