Window always appears on secondary monitor

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Sauce
Kobold
Posts: 26
Joined: Sat Mar 27, 2010 12:38 pm
x 2

Window always appears on secondary monitor

Post by Sauce »

I'm using OGRE 1.8 with the D3D9 RenderSystem, and when I create my application window, it is always spawned on the secondary monitor when 2 monitors are available. I've reproduced this on 2 other machines with a dual-monitor setup. My previous project, which used OGRE 1.71 didn't have this issue. I know there has been work on the render systems since 1.7, and was wondering if there have been any changes to the code that determines window positioning for this rendersystem. I haven't tested 3+ monitors but I suspect the window would always spawn on the n'th monitor instead of the primary. This is happening both in fullscreen and windowed mode.

I've had a look at OgreD3D9Renderwindow.cpp and couldn't determine the cause. Maybe someone else knows what's going on.

My window creation...

Code: Select all

m_pWindow = m_pOgreRoot->createRenderWindow("title", width, height, isFullscreen);
m_pWindow->setVisible(false);

//Other initialisation...

m_pwindow->setVisible(true);
Nothing fancy here - I'm just using the default window positioning OGRE gives me.

Upon further inspection, it seems RenderWindow::setVisible() is just a stub. I find that strange because I recall being able to show/hide windows a few months ago. It shouldn't have any effect on my problem though.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: Window always appears on secondary monitor

Post by Kojack »

Usually, the monitor it appears on is set in the ogre config dialog at the beginning.

On mine in 1.8 I have the Rendering Device entry in the dialog, which has the options of "Monitor-1-ATI Radeon HD 5800 Series", "Monitor-2-ATI Radeon HD 5800 Series" and "Monitor-3-ATI Radeon HD 5800 Series".
Sauce
Kobold
Posts: 26
Joined: Sat Mar 27, 2010 12:38 pm
x 2

Re: Window always appears on secondary monitor

Post by Sauce »

good point. I'm not using the default ogre configs so this is something I overlooked when passing my settings on to ogre.
CapnJJ
Gnoblar
Posts: 6
Joined: Tue Mar 09, 2010 7:48 am
x 1

Re: Window always appears on secondary monitor

Post by CapnJJ »

When creating your own render window, you can explicitly tell Ogre where to draw the window (which monitor).

It's pretty simple, just create a NameValuePairList with an element named "monitorIndex" and the desired index as the value (indices begin at 0, your main monitor would therefore be index 0, by default I believe), then pass that namevaluepairlist, as a reference, in the 5th parameter of createRenderWindow.

For example:

Code: Select all

      Ogre::NameValuePairList misc;
     [b][u] misc["monitorIndex"] = "0";[/u] [/b] //I use two monitors, so I tell Ogre to draw on my main (#1) monitor
      
// Here we tell the system not to create a default rendering window by passing 'false'
 
        mWindow = mRoot->initialise(false, "The Render Window");

//now we need to create a render window manually

      mWindow = mRoot->createRenderWindow("The Render Window",1680,1050,false, [b][u]&misc[/u] [/b]); //pass our custom attributes in "misc"
hope this helps

CapnJJ
Sauce
Kobold
Posts: 26
Joined: Sat Mar 27, 2010 12:38 pm
x 2

Re: Window always appears on secondary monitor

Post by Sauce »

Thanks for the info, now i don't have to go rummage through code looking for namevaluepair options :wink:
User avatar
cowtung
Gnoblar
Posts: 17
Joined: Wed Dec 16, 2015 10:28 pm

Re: Window always appears on secondary monitor

Post by cowtung »

For anybody who happens upon this thread like I did wondering why monitorIndex doesn't work for D3D11, I have patched it and submitted a pull request to fix that.

https://bitbucket.org/sinbad/ogre/pull- ... d3d11/diff