[SOLVED] Gentoo Git build

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Alfred
Posts: 13
Joined: 06 May 2012, 00:35
Location: Toruń, Poland
Contact:

[SOLVED] Gentoo Git build

Post by Alfred »

=== QUICK COMPILATION GUIDE
install Ogre 1.8
install MyGui
install Bullet 2.80
cmake-gui (point to source folder, Configure, Generate)
make (in the source/build folder)
===

Hello! I found this project yesterday, and as I have played Morrowind long ago, and saw the progress in recreating it on YouTube, I decided to give it a try. Also the idea of using Ogre and Bullet appeals to me very much, having such a big and complete world to work on would be just great!

So, I first tried the 0.14 release, and found some problems with compiling. After some searching I managed to get my hands on the Git repository, cloned it and tried that. Unfortunately there seemd to be the same issues there. These are the changes I had to make to compile:

Code: Select all

diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp
index c81f23f..f30a08c 100644
--- a/apps/openmw/mwrender/water.cpp
+++ b/apps/openmw/mwrender/water.cpp
@@ -275,13 +275,13 @@ void Water::createMaterial()

         TexturePtr colorTexture = compositor->getTextureInstance("mrt_output", 0);
         TextureUnitState* tus = mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState("refractionMap");
-        if (tus != 0)
-            tus->setTexture(colorTexture);
+//        if (tus != 0)
+//            tus->setTexture(colorTexture);
 
         TexturePtr depthTexture = compositor->getTextureInstance("mrt_output", 1);
         tus = mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState("depthMap");
-        if (tus != 0)
-            tus->setTexture(depthTexture);
+//        if (tus != 0)
+//            tus->setTexture(depthTexture);
     }
 }
 
diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp
index fa197d9..872707b 100644
--- a/components/bsa/bsa_archive.cpp
+++ b/components/bsa/bsa_archive.cpp
@@ -307,7 +307,7 @@ return arc.exists(passed.c_str());
     if(cexists(pattern))
       {
         FileInfo fi;
-        fi.archive = this;
+        //fi.archive = this;
         fi.filename = pattern;
         // It apparently doesn't matter that we return bogus
         // information
diff --git a/libs/openengine/bullet/BulletShapeLoader.cpp b/libs/openengine/bullet/BulletShapeLoader.cpp
index 59a414f..4593bad 100644
--- a/libs/openengine/bullet/BulletShapeLoader.cpp
+++ b/libs/openengine/bullet/BulletShapeLoader.cpp
@@ -63,17 +63,17 @@ size_t BulletShape::calculateSize() const
 
 
 //=============================================================================================================
-template<> BulletShapeManager *Ogre::Singleton<BulletShapeManager>::msSingleton = 0;
+template<> BulletShapeManager *Ogre::Singleton<BulletShapeManager>::ms_Singleton = 0;
 
 BulletShapeManager *BulletShapeManager::getSingletonPtr()
 {
-    return msSingleton;
+    return ms_Singleton;
 }
 
 BulletShapeManager &BulletShapeManager::getSingleton()
 {
-    assert(msSingleton);
-    return(*msSingleton);
+    assert(ms_Singleton);
+    return(*ms_Singleton);
 }
 
 BulletShapeManager::BulletShapeManager()
diff --git a/libs/openengine/ogre/imagerotate.cpp b/libs/openengine/ogre/imagerotate.cpp
index 11fd5ee..ccc25b8 100644
--- a/libs/openengine/ogre/imagerotate.cpp
+++ b/libs/openengine/ogre/imagerotate.cpp
@@ -1,4 +1,5 @@
 #include "imagerotate.hpp"
+#include "../OgreMaterialManager.h"
 
 #include <OgreRoot.h>
 #include <OgreSceneManager.h>
@@ -19,7 +20,7 @@ void ImageRotate::rotate(const std::string& sourceImage, const std::string& dest
     SceneManager* sceneMgr = root->createSceneManager(ST_GENERIC);
     Camera* camera = sceneMgr->createCamera("ImageRotateCamera");
 
-    MaterialPtr material = MaterialManager::getSingleton().create("ImageRotateMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+    MaterialPtr material = MaterialManager::getSingletonPtr()->create("ImageRotateMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
     material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
     material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
     TextureUnitState* tus = material->getTechnique(0)->getPass(0)->createTextureUnitState(sourceImage);
I'm not sure if this breaks anything, those seem to be either features disabled or rarely used functions only used for compatibility.

After those changes the source compiled, but I still have SegFaults at runtime, so tried to pinpoint them with gdb, here is what I have right now:

Code: Select all


diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp
index a95a179..68a2acc 100644
--- a/apps/openmw/mwrender/renderingmanager.cpp
+++ b/apps/openmw/mwrender/renderingmanager.cpp
@@ -344,9 +344,18 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue
     mRendering.getViewport()->setBackgroundColour (colour);
 
     CompositorInstance* inst = CompositorManager::getSingleton().getCompositorChain(mRendering.getViewport())->getCompositor("gbuffer");
-    if (inst != 0)
-        inst->getCompositor()->getTechnique(0)->getTargetPass(0)->getPass(0)->setClearColour(colour);
-    if (mWater)
+    if (inst != 0) {
+            if (inst->getCompositor()->getTechnique(0)->getNumTargetPasses() == 0)
+                inst->getCompositor()->getTechnique(0)->createTargetPass();
+
+            CompositionTargetPass* tpass;
+            tpass = inst->getCompositor()->getTechnique(0)->getTargetPass(0);
+            if (tpass->getNumPasses() == 0)
+                tpass->createPass();
+
+            tpass->getPass(0)->setClearColour(colour);    
+    }
+        if (mWater)
         mWater->setViewportBackground(colour);
 }
 
Seems rather minor - rendering passes were not created before use... Strange, still.

I'm fixing more as I go along, but I'm wondering if this is the right branch I'm trying to run? Is this the current code? Seems only a few days old in some places, but I read in the Development board that there is a more recent Ogre 1.8 branch in the works, which should I use?
Last edited by Alfred on 06 May 2012, 21:39, edited 2 times in total.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Gentoo Git build

Post by Zini »

You are compiling against the wrong version of OGRE. Recent OpenMW versions need OGRE 1.8RC.
Alfred
Posts: 13
Joined: 06 May 2012, 00:35
Location: Toruń, Poland
Contact:

Re: Gentoo Git build

Post by Alfred »

So the master branch uses Ogre 1.8RC?

BTW, this is as far as I got:

Code: Select all

fred@iguana ~/games/Morrowind $ gdb openmw
GNU gdb (Gentoo 7.3.1 p1) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /home/fred/games/Morrowind/openmw...done.
(gdb) run
Starting program: /home/fred/games/Morrowind/openmw 
[Thread debugging using libthread_db enabled]
Loading config file: /home/fred/.config/openmw/openmw.cfg... done.
Loading config file: ./openmw.cfg... done.
Using default (English) font encoding.
No master file given. Assuming Morrowind.esm
[New Thread 0x7fffe9100700 (LWP 18209)]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff773d826 in Ogre::PrefabFactory::createSphere(Ogre::Mesh*) () from /usr/lib64/libOgreMain.so.1.7.4
(gdb) backtrace
#0  0x00007ffff773d826 in Ogre::PrefabFactory::createSphere(Ogre::Mesh*) () from /usr/lib64/libOgreMain.so.1.7.4
#1  0x00007ffff773de6a in Ogre::PrefabFactory::createPrefab(Ogre::Mesh*) () from /usr/lib64/libOgreMain.so.1.7.4
#2  0x00007ffff76e1e88 in Ogre::MeshManager::loadResource(Ogre::Resource*) () from /usr/lib64/libOgreMain.so.1.7.4
#3  0x00007ffff7770e53 in Ogre::Resource::load(bool) () from /usr/lib64/libOgreMain.so.1.7.4
#4  0x00007ffff76df480 in Ogre::MeshManager::createPrefabSphere() () from /usr/lib64/libOgreMain.so.1.7.4
#5  0x00007ffff7790d44 in Ogre::Root::oneTimePostWindowInit() () from /usr/lib64/libOgreMain.so.1.7.4
#6  0x00007ffff77950ca in Ogre::Root::initialise(bool, std::string const&, std::string const&) () from /usr/lib64/libOgreMain.so.1.7.4
#7  0x00000000006fc8c5 in OEngine::Render::OgreRenderer::createWindow(std::string const&) ()
#8  0x00000000009e33d3 in OMW::Engine::go() ()
#9  0x00000000009d5d93 in main ()
User avatar
werdanith
Posts: 295
Joined: 26 Aug 2011, 16:18

Re: Gentoo Git build

Post by werdanith »

Alfred wrote:So the master branch uses Ogre 1.8RC?
Yes, Ogre 1.8 RC1
Revert all the changes you made, and try compiling with the new Ogre.
If you then encounter any issues compiling or running the game, let us know.
Alfred
Posts: 13
Joined: 06 May 2012, 00:35
Location: Toruń, Poland
Contact:

Re: Gentoo Git build

Post by Alfred »

Hurray! It worked after installing Ogre 1.8 and recompiling MyGui. :mrgreen: There is an empty section for instructions on compiling from source in the readme.txt, but it was really quite straight forward on Linux. Simplified version here:
install Ogre 1.8
install MyGui
cmake-gui (point to source folder, Configure, Generate)
make (in the source/build folder)

One more question, doors don't seem to work and I could only see one cavern, is there a way to get out of it? Also, I saw the camera "walk" around the map in the video, how to turn that on? I suppose the console can be used for that like in the video, are the commands documented somewhere?
User avatar
Amenophis
Posts: 320
Joined: 30 Oct 2011, 04:34
Location: Fortaleza - Ceará - Brasil

Re: Gentoo Git build

Post by Amenophis »

User avatar
Necrod
Posts: 251
Joined: 26 Mar 2012, 17:00
Location: Croatia/Pula

Re: Gentoo Git build

Post by Necrod »

Alfred wrote: One more question, doors don't seem to work and I could only see one cavern, is there a way to get out of it?
You can't get out by activating doors. You open console and type in coc "name of the place you want to go"
for example "coc balmora"
Alfred
Posts: 13
Joined: 06 May 2012, 00:35
Location: Toruń, Poland
Contact:

Re: [SOLVED] Gentoo Git build

Post by Alfred »

Thanks for the help! Well, I was looking for the reference to console commands, like in your example "coc balmora", the movement controls were obvious - I got what I needed by trial and error. ;) BTW when in Balmora my framerate dropped from a healthy 44 down to 1 - it looks great, but seems almost unusable... :/

EDIT: Interesting, after loading Gnisis I ended up in water, which enabled me to see a strange behaviour: when the console was open, the framerate was ~40 fps, but after turning it off it goes down to 1 - this is particularly visible when in water, because it can clearly be seen swirling (or not).
User avatar
jvoisin
Posts: 303
Joined: 11 Aug 2011, 18:47
Contact:

Re: [SOLVED] Gentoo Git build

Post by jvoisin »

Yes, Balmora is a framerate killer for now, this is known.

About your "concern" in Gnisis : when the console is activated, a lot of computations (physics, animations, ...) are turned off (iirc), this is why you've got a big increase in your fps.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: [SOLVED] Gentoo Git build

Post by Zini »

You can't get out by activating doors.
Um .. no? Load doors have been working for ages. Only non-load doors don't work.
Locked