[PATCH] render to texture in Ogre 2.0

Issue #1143 new
Robert Paciorek
created an issue


It's not possible render CEGUI to Ogre texture in Ogre 2.0 (at least when using window render target as main rendering target).

Call draw() on GUIContext using texture target has no effect or creating artifacts on window render target. Even TextureTarget::clear() does not work.


OgreRenderTarget use Ogre::RenderSystem::_setViewport() in activate() method to switch rendering target between various textures and window target.

When build CEGUI for Ogre 2.0 this code is disabled via #ifndef CEGUI_USE_OGRE_COMPOSITOR2, so it's not possible switch target.

Proposed fix

Restore support for viewports in CEGUI code for Ogre 2.0. Attached patch was tested in Ogre 1.9, 2.0 (window and texture targets) and 2.1 (only window target).

Comments (3)

  1. Yaron Cohen-Tal

    @Robert Paciorek: Thanx a lot for the proposed patch! The problem of render to texture not working in Ogre 2.x is known. I've started to work on a solution but unfortunately got occupied with other things so haven't finished it yet. Your patch, however, takes us backwards: The right way to go in Ogre 2.x is using the new compositor. Therefore we're gonna have to decline your patch.

    If by the time of the next cegui release I won't have finished my work on this, We'll reconsider your patch as a temporary solution.

    As a side note, the right way to propose a change to cegui is using a PR (pull request). It makes it easier to comment on it and make changes to it, and will greatly improve the chance your change is approved and merged to the official cegui repository.

  2. Log in to comment