title: Ogre 3d: RenderTexture bigger than RenderWindow
body: <p>I have two ogre applications:</p>
  
  <p><strong>1) Sub application</strong>, that render to a window and to a texture (using same camera). The texture is "exported" to shared memory (shm in linux)</p>
  
  <p><strong>2) Main application</strong>, where a plane shows what is happening in the (1) "sub application", loading the texture from shared memory.</p>
  
  <p>The texture where (1) renders has same size than texture used by plane in (2). E.g.: 512x512</p>
  
  <p><strong>All works fine</strong> if the RenderWindow is bigger or equal than RenderTexture.
  What you see in (1) is reflected in (2) plane with decent fps. Shared memory is powerful!</p>
  
  <p>But if render window is smaller than texture, <strong>only a part of texture is updated</strong>.</p>
  
  <p>This is what is happening to me:
  <img src="https://i.stack.imgur.com/zJhX0.jpg" alt="renderwindow smaller than rendertexture"></p>
  
  <p>Some examples show 1x1 window and big render texture, so i guess it's possible to have a render texture bigger than the window.</p>
  
  <p>This is how the window is created:</p>
  
  <pre><code>window_ = root_-&gt;createRenderWindow("blablah"), 256, 256, false);
  </code></pre>
  
  <p>This is how the render texture is created:</p>
  
  <pre><code>TextureManager* tm = TextureManager::getSingletonPtr();
  TexturePtr rttTexture = tm-&gt;createManual(
  /**/"MainRTT"
  /**/, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME
  /**/, TEX_TYPE_2D
  /**/, 512
  /**/, 512
  /**/, 0
  /**/, PF_R8G8B8A8
  /**/, TU_RENDERTARGET);
  RenderTexture* renderTarget = rttTexture-&gt;getBuffer()-&gt;getRenderTarget();
  renderTarget-&gt;addViewport(camera_);
  renderTarget-&gt;setAutoUpdated(false);
  Viewport* vp = renderTarget-&gt;getViewport(0);
  vp-&gt;setClearEveryFrame(true);
  vp-&gt;setOverlaysEnabled(true);
  vp-&gt;setBackgroundColour(ColourValue::Black);
  </code></pre>
  
  <p>This is how i update the render texture: </p>
  
  <pre><code>class ShmTexUpdater: public Ogre::FrameListener {
  public:
      ShmTexUpdater(const int&amp; width, const int&amp; height, void* data,
              const TexturePtr&amp; tex) :
          /**/width_(width)
          /**/, height_(height)
          /**/, data_(data)
          /**/, tex_(tex)
          /**/, buf_(tex-&gt;getBuffer())
          /**/, renderTarget_(tex-&gt;getBuffer()-&gt;getRenderTarget()){
  
      }
      virtual ~ShmTexUpdater() {
  
      }
  private:
      virtual bool frameStarted(const FrameEvent&amp; evt) {
          FrameWork::instance()-&gt;window()-&gt;update();
          buf_-&gt;lock(Ogre::HardwareBuffer::HBL_NORMAL);
          renderTarget_-&gt;update();
          tex_-&gt;getBuffer()-&gt;blitToMemory(
          /**/PixelBox(width_, height_, 1, ShmTexture4k::FORMAT, data_));
          buf_-&gt;unlock();
          return true;
      }
      int const width_;
      int const height_;
      void* const data_;
      TexturePtr const tex_;
      HardwarePixelBufferSharedPtr buf_;
      RenderTexture* renderTarget_;
  };
  </code></pre>
  
  <p>Reading description of RenderWindow and RenderTexture, this is not what I'm expecting to happen. So... is this ogre bug, or opengl? Or am I doing it wrong?</p>
  
  <ul>
  <li>OS: Linux</li>
  <li>Ogre: Version 1.7.3 (Cthugha)</li>
  <li>GL_VERSION = 4.0.0 NVIDIA 256.53</li>
  </ul>