I have two ogre applications:
1) For an application that displays a window and texture (using the same camera). The texture is "exported" to shared memory (shm in linux).
2) The main application , where the plane shows what happens in the (1) "routine", loading the texture from the shared memory.
A texture where (1) the rendering is the same size as the texture used by the plane in (2). For example: 512x512
Everything works fine if the RenderWindow is greater than or equal to the RenderTexture. What you see in (1) is reflected in the plane (2) with decent fps. The shared memory is powerful!
But if the rendering window is smaller than the texture, only part of the texture is updated .
This is what happens to me:

Some examples show a 1x1 window and a large rendering texture, so I assume that the rendering texture is larger than the window.
This creates a window:
window_ = root_->createRenderWindow("blablah"), 256, 256, false);
This creates the rendering texture:
TextureManager* tm = TextureManager::getSingletonPtr();
TexturePtr rttTexture = tm->createManual(
"MainRTT"
, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME
, TEX_TYPE_2D
, 512
, 512
, 0
, PF_R8G8B8A8
, TU_RENDERTARGET);
RenderTexture* renderTarget = rttTexture->getBuffer()->getRenderTarget();
renderTarget->addViewport(camera_);
renderTarget->setAutoUpdated(false);
Viewport* vp = renderTarget->getViewport(0);
vp->setClearEveryFrame(true);
vp->setOverlaysEnabled(true);
vp->setBackgroundColour(ColourValue::Black);
This is how I update the rendering texture:
class ShmTexUpdater: public Ogre::FrameListener {
public:
ShmTexUpdater(const int& width, const int& height, void* data,
const TexturePtr& tex) :
width_(width)
, height_(height)
, data_(data)
, tex_(tex)
, buf_(tex->getBuffer())
, renderTarget_(tex->getBuffer()->getRenderTarget()){
}
virtual ~ShmTexUpdater() {
}
private:
virtual bool frameStarted(const FrameEvent& evt) {
FrameWork::instance()->window()->update();
buf_->lock(Ogre::HardwareBuffer::HBL_NORMAL);
renderTarget_->update();
tex_->getBuffer()->blitToMemory(
PixelBox(width_, height_, 1, ShmTexture4k::FORMAT, data_));
buf_->unlock();
return true;
}
int const width_;
int const height_;
void* const data_;
TexturePtr const tex_;
HardwarePixelBufferSharedPtr buf_;
RenderTexture* renderTarget_;
};
Reading the description of RenderWindow and RenderTexture is not what I expect. So ... is this an ogre error, or opengl? Or am I doing it wrong?
- OS: Linux
- Ogre: version 1.7.3 (Cthugha)
- GL_VERSION = 4.0.0 NVIDIA 256.53