[2.2] Easiest way to show overlays on selected windows

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

[2.2] Easiest way to show overlays on selected windows

Post by xrgo »

Hello!
In my apps I can have many windows (and many screens), and those windows uses the same workspace definition with mIncludeOverlays = true, later I create some overlays to show some cameras, textures, info, etc. but I want to show the overlays in just one of the screens... for now... later I would like to show specific overlays on specific windows.

this used to be simple on 1.X with viewport and rendertarget, but there's no more of that on 2.2. I can imagine a couple of solutions but are a bit overkill for something this simple, what would be the easiest solution?

thanks!!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Easiest way to show overlays on selected windows

Post by dark_sylinc »

Use execution masks to prevent certain passes from executing when instantiating the workspace:

Code: Select all

//In script, overlay pass:
execution_mask 0x01

//Have overlays
mgr->addWorkspace( ..., executionMask = 0x01, ... );

//No overlays
mgr->addWorkspace( ..., executionMask = ~0x01, ... );
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [2.2] Easiest way to show overlays on selected windows

Post by xrgo »

mmm that means that I would need to put the overlays in a separated pass, and I have a problem with that: viewtopic.php?f=25&t=94960
I am going to try again, maybe I find a combination that don't causes the yflipping problem

thanks!
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [2.2] Easiest way to show overlays on selected windows

Post by xrgo »

if I put the overlay pass before the quad pass I can avoid the flipping problem...
now I want to be hable to set which overlay to show on which window... for that I was planning to create some overlay passes (masked out by execution masks, so each pass only shows in 1 window) and every pass only renders a certain renderqueue, and if I want to show an overlay on a specific window I just need to set its renderqueue group

but!! it seems like overlay->setRenderQueueGroup its not working :S

I have this:

Code: Select all

mOverlay->setRenderQueueGroup( 250 );

Code: Select all

         //SCENE
            mPassSceneDef = static_cast<Ogre::CompositorPassSceneDef*>( targetDef->addPass( Ogre::PASS_SCENE ) );
		........
            mPassSceneDef->mLastRQ = 254;
and its not showing any overlay
but if I do

Code: Select all

mPassSceneDef->mLastRQ = 255;
it does show, its like the RenderQueueGroup is still 254

any ideas?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [2.2] Easiest way to show overlays on selected windows

Post by xrgo »

Its really easy to repro this behavior, just add:

Code: Select all

        mDebugOverlayPSSM->setRenderQueueGroup( 250 );
to the ShadowMapDebuggingSample
and

Code: Select all

			rq_first	0
			rq_last		254
to the compositor script and you'll see that the overlays don't show, and 250 is indeed between 0 and 254

is this an expected behavior? is a bug? do I need to enable something?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Easiest way to show overlays on selected windows

Post by dark_sylinc »

The short version is that Overlays are a hack. A separate render path created just for them until a more modern v2 version can replace it. 4 years later that replacement hasn't arrived yet.

The long version is this snippet:

Code: Select all

void OverlaySystem::renderQueueStarted( RenderQueue *rq, uint8 queueGroupId,
                                        const String& invocation, bool& skipThisInvocation )
{
    if(queueGroupId == mOverlayManager->mDefaultRenderQueueId) //<-- This snippet HERE
    {
        Ogre::Viewport* vp = Ogre::Root::getSingletonPtr()->getRenderSystem()->_getViewport();
        if(vp != NULL)
        {
            if (vp->getOverlaysEnabled())
            {
                OverlayManager::getSingleton()._queueOverlaysForRendering( rq, vp );
            }
        }
    }
}
I can't remember exactly why that was there. I think it was because otherwise renderQueueStarted would be called too frequently causing performance issues or rendering artifacts.
Or maybe overlays didn't like to live in different RQ IDs (i.e. they all have to be in the same RQ to be glitch free?).
It is also possible the reason it was added no longer applies.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [2.2] Easiest way to show overlays on selected windows

Post by xrgo »

thank you I am going to test =)
Post Reply