Ogre on Windows

A place to discuss everything about the Orxonox framework.

Moderator: PPS-Leaders

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Fri Sep 28, 2007 10:09 pm

In my version, there were ~20 examples, including a BSP application (BSP.cpp). If this is not the case, use this:

Code: Select all

/*
-----------------------------------------------------------------------------
This source file is part of OGRE
    (Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2006 Torus Knot Software Ltd
Also see acknowledgements in Readme.html

You may use this sample code for anything you like, it is not covered by the
LGPL like the rest of the engine.
-----------------------------------------------------------------------------
*/

#include "Ogre.h"
#include "ExampleApplication.h"
#include "ExampleLoadingBar.h"

/**
    \file 
        BSP.cpp
    \brief
        Shows the indoor level rendering (Binary Space Partition or BSP based).
    \par
        Also demonstrates loading levels from Quake3Arena and using
        curved bezier surfaces (as demonstrated in the Bezier example)
        in a large level.
*/

class BspApplication : public ExampleApplication
{
public:
	BspApplication()
	{


	}

protected:

	String mQuakePk3;
	String mQuakeLevel;
	ExampleLoadingBar mLoadingBar;

	void loadResources(void)
	{

		mLoadingBar.start(mWindow, 1, 1, 0.75);

		// Turn off rendering of everything except overlays
		mSceneMgr->clearSpecialCaseRenderQueues();
		mSceneMgr->addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
		mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);

		// Set up the world geometry link
		ResourceGroupManager::getSingleton().linkWorldGeometryToResourceGroup(
			ResourceGroupManager::getSingleton().getWorldResourceGroupName(), 
			mQuakeLevel, mSceneMgr);

		// Initialise the rest of the resource groups, parse scripts etc
		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		ResourceGroupManager::getSingleton().loadResourceGroup(
			ResourceGroupManager::getSingleton().getWorldResourceGroupName(),
			false, true);

		// Back to full rendering
		mSceneMgr->clearSpecialCaseRenderQueues();
		mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);

		mLoadingBar.finish();


	}

	// Override resource sources (include Quake3 archives)
	void setupResources(void)
	{

		// Load Quake3 locations from a file
		ConfigFile cf;

		cf.load("quake3settings.cfg");

		mQuakePk3 = cf.getSetting("Pak0Location");
		mQuakeLevel = cf.getSetting("Map");

		ExampleApplication::setupResources();
		ResourceGroupManager::getSingleton().addResourceLocation(
			mQuakePk3, "Zip", ResourceGroupManager::getSingleton().getWorldResourceGroupName(), true);

	}
	// Override scene manager (use indoor instead of generic)
	void chooseSceneManager(void)
	{
		mSceneMgr = mRoot->createSceneManager("BspSceneManager");
	}
	// Scene creation
	void createScene(void)
	{

		// modify camera for close work
		mCamera->setNearClipDistance(4);
		mCamera->setFarClipDistance(4000);

		// Also change position, and set Quake-type orientation
		// Get random player start point
		ViewPoint vp = mSceneMgr->getSuggestedViewpoint(true);
		mCamera->setPosition(vp.position);
		mCamera->pitch(Degree(90)); // Quake uses X/Y horizon, Z up
		mCamera->rotate(vp.orientation);
		// Don't yaw along variable axis, causes leaning
		mCamera->setFixedYawAxis(true, Vector3::UNIT_Z);


	}

};


#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char**argv)
#endif
{
    // Create application object
    BspApplication app;

    try {
        app.go();
    } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        std::cerr << "An exception has occured: " << 
            e.getFullDescription().c_str() << std::endl;
#endif
    }

    return 0;
}

#ifdef __cplusplus
}
#endif

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Sat Sep 29, 2007 9:16 am

Alright. I managed to run it...

On my IBM Laptop with 1GB RAM, Intel Pentium with 1,7Ghz and a graphics card from ATI: Radeon Mobility 7500 with 128-bit memory and Ubuntu 7.04 using NOT the Driver from ATI (Atheros HAL) I get average FPS of 80 to 110 in small rooms and corridors.
In big halls it drops to 20 to 25 FPS and in the huge hall where there is supposed to be the meteor core held in the middle of the room the frame rate drops down to 10 to 15 with the worst seen FPS rate of 8. Leaving the map the FPS drops down to unplayable 4 FPS.

I change the graphic driver and report the changes. (Reboot)

Is this possible?
Loading is longer, everything looks ugly and the frame rate is not even 1?? Did I do something wrong? Like leave both drivers running?
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Sat Sep 29, 2007 1:13 pm

It looks ugly? Can you explain that a bit more precise? :P

My framerates on a Athlon 3500+ with GeForce 6800 GT and 1 GB ram:

DirectX, Release mode:
- Startpoint: 140
- Looking in the opposite direction: 385
- Looking down from the top of the elevator shaft: 130
- Entering the room with the power core: 150
- Average FPS in the hangar: 55
- Worst FPS in the hangar: 45
- Outside the map: ~30

DirectX, Debug mode:
- Startpoint: 70
- Looking in the opposite direction: 180
- Looking down from the top of the elevator shaft: 45
- Entering the room with the power core: 50
- Average FPS in the hangar: 20
- Worst FPS in the hangar: 15
- Outside the map: ~10

OpenGL, Release mode:
- Startpoint: 13
- Looking in the opposite direction: 35
- Looking down from the top of the elevator shaft: 13
- Entering the room with the power core: 15
- Average FPS in the hangar: 10
- Worst FPS in the hangar: 8
- Outside the map: ~5

OpenGL, Debug mode:
- Startpoint: 12
- Looking in the opposite direction: 33
- Looking down from the top of the elevator shaft: 10
- Entering the room with the power core: 13
- Average FPS in the hangar: 8
- Worst FPS in the hangar: 6
- Outside the map: ~4


Summary: As you can see, it's unplayable with OpenGL on windows. Your FPS are quite good in small rooms, but the framedrop to 10-15 in the meteor core room is strange, I noticed nothing like that on my system.
I tested with Release and Debug mode to show that there is - at least with DirectX - a big difference between both modes. Make sure you compiled it in release mode.
OpenGL is obviously faster on Linux than on Windows, but I'm not really happy with those framedrops in bigger rooms. Anyway it's not that bad, so maybe it works good with correct drivers.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Sat Sep 29, 2007 1:23 pm

Yeah, it really is strange. In the hangar my frame rate is not THAT bad. It's again a large room so there is a drop the more than 20 fps, but nothing too serious.
OpenGL seems to work better.

I'm not sure about debug and release mode. I've seen different config files for those modes, but I don't know. Do I have to recompile Ogre with a different configure?
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Sat Sep 29, 2007 1:37 pm

beni wrote:Yeah, it really is strange. In the hangar my frame rate is not THAT bad. It's again a large room so there is a drop the more than 20 fps, but nothing too serious.
Yes, 20 fps in the hangar are ok, that's more or less what I've expected from your system. (I'll do several improvements in the hangar, so in the final version the fps will be better.)

I'm not sure about debug and release mode. I've seen different config files for those modes, but I don't know. Do I have to recompile Ogre with a different configure?
On windows there are two versions of each library, one for release and one for debug mode. Of course you need to compile both, but maybe you've already done that, I have no idea. To compile the BSP example, you have to link to the debug-version of the libraries, they have _d at the end of their name (at least on windows).

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Sat Sep 29, 2007 1:46 pm

Ah yes, read something about that. I'll test it right away.

I'm not sure why the meteor core hall is like this. But this may be some bug/error.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
patrick
Baron Vladimir Harkonnen
Posts: 350
Joined: Mon Oct 02, 2006 6:03 pm
Location: Bern

Post by patrick » Sat Sep 29, 2007 3:44 pm

is the frame-drop with opengl bsp specific or is it a general ogre problem? don't hesitate to bug the ogre community about such things, then you will see how willing to help they are :D

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Sat Sep 29, 2007 4:34 pm

I guess it's hardware/driver specific. Let's see how willing to help IBM is :D

User avatar
Nowic
Thanathon, God of the lower Planes
Posts: 186
Joined: Tue Oct 03, 2006 7:53 pm
Location: Zürich
Contact:

Post by Nowic » Sat Sep 29, 2007 5:04 pm

Note: The currrent ATI-linux-drivers have a very poor performance and stability problems. But AMD is rewriting them completely... maybe they will be included in Ubuntu 7.10.

http://en.wikipedia.org/wiki/Fglrx

fglrx 8.41.7 was released on September 12, 2007 HD 2xxx (R600) and new driver codebase.

http://packages.ubuntu.com/cgi-bin/sear ... elease=all

Not included yet.
"I've always lived cheaply. I live like a student, basically. And I like that because it means that money is not telling me what to do. I can do what I think is important for me to do. It freed me to do what seemed worth doing." -- Richard Stallman

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Sat Sep 29, 2007 5:30 pm

I checked out the other samples. All of them (except fresnel and spinal) work good (150 to 300 fps). I think we can really use this engine and the samples learn us quickly how stuff works. I already saw stuff we could use for those orx weapons I suggested months ago. Also the wobble stuff we used can be done by some other effect I've seen in the samples.

The question is now: Should we take this engine even though it's not sure why there are some strange behaviors in BSP and even more interesting: If yes, what plugins do we need to have installed as well? I'd like to write the ISG an email as quickly as possible.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Sat Sep 29, 2007 6:33 pm

I say yes, because I think we can handle those problems.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests