本文整理汇总了C++中ogre::HardwarePixelBufferSharedPtr::getRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ HardwarePixelBufferSharedPtr::getRenderTarget方法的具体用法?C++ HardwarePixelBufferSharedPtr::getRenderTarget怎么用?C++ HardwarePixelBufferSharedPtr::getRenderTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::HardwarePixelBufferSharedPtr
的用法示例。
在下文中一共展示了HardwarePixelBufferSharedPtr::getRenderTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void MiniMapMaker::init(void)
{
// 创建纹理
Ogre::TexturePtr pTexture = Ogre::TextureManager::getSingleton().createManual(
"RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
mTexWidth, mTexHeight, 1, 0, mOutPutFormat,
Ogre::TU_RENDERTARGET, 0);
Ogre::HardwarePixelBufferSharedPtr pBuffer = pTexture->getBuffer(0, 0);
mRenderTexture = pBuffer->getRenderTarget(0);
{
mCamera = mManipulator->getSceneManager()->createCamera("RttCam");
// 设置摄像机的基本属性
mCamera->setAspectRatio(1);
mCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
mCamera->setFOVy(Ogre::Degree(90));
_setCameraAttribute();
Ogre::Viewport *v = mRenderTexture->addViewport( mCamera );
v->setClearEveryFrame( true );
v->setBackgroundColour( Ogre::ColourValue::Black );
v->setOverlaysEnabled(false);
v->setSkiesEnabled(false);
v->setShadowsEnabled(true);
}
}
示例2: textureName
CRosRttTexture::CRosRttTexture(unsigned width, unsigned height, Ogre::Camera * camera, bool isDepth /*= false*/ )
: m_materialName("MyRttMaterial")
, width_(width)
, height_(height)
, frame_("/map")
, m_bIsDepth( isDepth )
{
assert( height > 0 && width > 0 );
{
// Set encoding
current_image_.encoding = ROS_IMAGE_FORMAT;
// Set image size
current_image_.width = width;
current_image_.height = height;
// Set image row length in bytes (row length * 3 bytes for a color)
current_image_.step = width * BPP;
#if OGRE_ENDIAN == ENDIAN_BIG
current_image_.is_bigendian = true;
#else
current_image_.is_bigendian = false;
#endif
// Resize data
current_image_.data.resize( width_ * height_ * BPP);
}
Ogre::TextureManager & lTextureManager( Ogre::TextureManager::getSingleton() );
Ogre::String textureName("RVIZ_CamCast_Texture");
bool lGammaCorrection( false );
unsigned int lAntiAliasing( 0 );
unsigned int lNumMipmaps( 0 );
if( isDepth )
{
texture_ = lTextureManager.createManual(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, width, height, lNumMipmaps,
OGRE_DEPTH_TEXTURE_FORMAT, Ogre::TU_RENDERTARGET, 0, lGammaCorrection, lAntiAliasing);
}
else
{
texture_ = lTextureManager.createManual(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, width, height, lNumMipmaps,
OGRE_TEXTURE_FORMAT, Ogre::TU_RENDERTARGET, 0, lGammaCorrection, lAntiAliasing);
}
// Create render target
Ogre::RenderTexture* lRenderTarget = NULL;
Ogre::HardwarePixelBufferSharedPtr lRttBuffer = texture_->getBuffer();
lRenderTarget = lRttBuffer->getRenderTarget();
lRenderTarget->setAutoUpdated(true);
// Create and attach viewport
Ogre::Viewport* lRttViewport1 = lRenderTarget->addViewport(camera, 50, 0.00f, 0.00f, 1.0f, 1.0f);
lRttViewport1->setAutoUpdated(true);
Ogre::ColourValue lBgColor1(0.0,0.0,0.0,1.0);
lRttViewport1->setBackgroundColour(lBgColor1);
// create a material using this texture.
//Get a reference on the material manager, which is a singleton.
Ogre::MaterialManager& lMaterialManager = Ogre::MaterialManager::getSingleton();
Ogre::MaterialPtr lMaterial = lMaterialManager.create(m_materialName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::Technique * lTechnique = lMaterial->getTechnique(0);
Ogre::Pass* lPass = lTechnique->getPass(0);
if( isDepth )
{
lPass->setLightingEnabled(false);
}
Ogre::TextureUnitState* lTextureUnit = lPass->createTextureUnitState();
lTextureUnit->setTextureName(textureName);
lTextureUnit->setNumMipmaps(0);
lTextureUnit->setTextureFiltering(Ogre::TFO_BILINEAR);
update();
}