|
各位好,我现在用osgWidget作界面,然后有用到rtt相机,就是将一个rtt相机下的纹理贴到osgWidget::widget下,但是我现在弄一直显示不出来(图片显示不出来),rtt相机设置如下:
-
- mRttCamera->setRenderOrder(osg::Camera::PRE_RENDER);
- mRttCamera->setGraphicsContext(mGc.get());
- mRttCamera->setViewport(0, 0, mWidth, mHeight);
- mT2d->setInternalFormat(GL_RGBA);
- mViewer->addSlave(mRttCamera, false);
- mRttCamera->attach(osg::Camera::COLOR_BUFFER, mT2d);
- mRttCamera->addChild(osgDB::readNodeFile("cow.osg"));
复制代码-
- osgWidget::Widget* ArtWidget = new osgWidget::Widget("ArtWidget", mWidth/3.0, mHeight/2.0);
- ArtWidget->setColor(1.0, 0.0, 0.0, 1.0);
- ArtWidget->getOrCreateStateSet()->setTextureAttributeAndModes(0, mT2d, osg::StateAttribute::ON);
- mShowCanvas->addWidget(ArtWidget, 0.0, 0.0);
- mShowCanvas->setOrigin(mWidth/3.0, mHeight/4.0);
- this->addChild(mShowCanvas);
复制代码
中间的空白本来应该显示一头牛的。但是没有显示不出来。
各位大侠指点一下。。。 |
|