Hi, I'm porting a project from basic glut/openGL to Ogre, and I have a little problem : I don't find how to setup the window, so it can be rendered even if it isn't at top, and so I can still see the mouse and select other windows.
I'm currently using the exempleApplication class, and I have to do a "alt tab" to see the mouse pointer, and then the render stops until I put Ogre on top again.
Don't know if it is a Ogre problem or a windows API one...
Thanks!
How to setup the Ogre window?
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
This is because OGRE is running the rendering loop for you, and the default behaviour is to only render when the window is in focus, not show the OS mouse, and other such game-like behaviour.
If you want to have different behaviour, it's probably because you're writing a tool of some sort, and in this case you should create the window yourself and pass the handle to OGRE in the externalWindowHandle parameter when you create a window. You should then run the window loop yourself, however you like - telling the window when to update (paint events) etc.
If you want to have different behaviour, it's probably because you're writing a tool of some sort, and in this case you should create the window yourself and pass the handle to OGRE in the externalWindowHandle parameter when you create a window. You should then run the window loop yourself, however you like - telling the window when to update (paint events) etc.
-
- Halfling
- Posts: 57
- Joined: Mon Apr 18, 2005 5:46 pm
-
- Halfling
- Posts: 88
- Joined: Tue Nov 30, 2004 2:34 am
This sounds good in theory but here i set I have my winapi app running and im starting to but child window contorls in and want to render ogre in a child window. This seems easy at first till you get to the point where you have to init ogre. I dont want the dialog box that gets the prams I need to get ogre up to the renderone frame state.sinbad wrote:This is because OGRE is running the rendering loop for you, and the default behaviour is to only render when the window is in focus, not show the OS mouse, and other such game-like behaviour.
If you want to have different behaviour, it's probably because you're writing a tool of some sort, and in this case you should create the window yourself and pass the handle to OGRE in the externalWindowHandle parameter when you create a window. You should then run the window loop yourself, however you like - telling the window when to update (paint events) etc.
Ok can you just jot down a few lines of clues on the basic steps to get ogre rendering.
I have this so far.
new root
load resources file parse it
?qestion on what to do for configure
choose scenemanager
create/position camera
load and position somthing to view
renderoneframe
I plan on setting up a timer under winapi to fire the renderloop so the gui of the tool doesnt get bogged down from the renderloop, or I might make the render loop run from the winproc function for the window ogre is in.
The question is how do I pass the handle(hwnd) for the window to ogre?
-
- Halfling
- Posts: 88
- Joined: Tue Nov 30, 2004 2:34 am
Code: Select all
mRoot = new Root();
ConfigFile cf;
cf.load("resources.cfg");
ConfigFile::SectionIterator seci = cf.getSectionIterator();
String sec,type,arch;
while(seci.hasMoreElements())
{
sec = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for(i = settings->begin();i!=settings->end();i++)
{
type = i->first;
arch = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
arch,type,sec);
}
}
RenderSystemList* lstRend;
RenderSystemList::iterator pRend;
// in resource.cfg we only load one rendersystem plugin
// so we dont need to sort the list of system in this app
lstRend = mRoot->getSingleton().getAvailableRenderers();
pRend = lstRend->begin();
mRoot->getSingleton().setRenderSystem(pRend[0]);
mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
mWindow = mRoot->initialise(true,"OgreEdmWindow");
mCamera = mSceneMgr->createCamera("nToolCam");
mCamera->setPosition(Vector3(500,200,0));
mCamera->lookAt(Vector3(0,100,0));
mCamera->setNearClipDistance(5);
mCamera->setFarClipDistance(20000);
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
@Yokom: This looks okay - but I think you could (and should) save some work and get hold of ogreaddons from CVS.
There you should browse the code for meshviewer - it does exactly what you are trying to do. You might pick up some tricks.
There you should browse the code for meshviewer - it does exactly what you are trying to do. You might pick up some tricks.

/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Halfling
- Posts: 88
- Joined: Tue Nov 30, 2004 2:34 am
Thats good news ill pull that up and look though it thanks, and getting some sleep helps also.jacmoe wrote:@Yokom: This looks okay - but I think you could (and should) save some work and get hold of ogreaddons from CVS.
There you should browse the code for meshviewer - it does exactly what you are trying to do. You might pick up some tricks.