Building Ogre .NET bindings Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 5

Building Ogre .NET bindings

Post by demeter »

Hello,

I found out Ogre has official .NET bindings now-a-days and would like to use it because I'm experienced with .NET but know only little about C++ and zero about cmake. :)

I found this bit of info: https://github.com/OGRECave/ogre/tree/m ... les/Csharp but I can't find that "build/csharp" folder that it talks about. I downloaded the master branch and looked for build, csharp, and *.cs, but except for a cmake file and the demo .cs file, I cant find anything.

I also searched through a prebuilt SDK download, but I didnt find any "ogre.dll", i did find a "libOgre.ddl" though.

Does anyone know how to build for .NET use, or know of some more info about this?

thanks
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

the contents of "build/csharp/" will be auto-generated if you build ogre with the CSharp component (requires SWIG). Here, "build" refers to the build folder.
The prebuild SDK currently does not include the .NET part as it was not yet tested on Windows. However I probably can change that for the devel builds..
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 5

Re: Building Ogre .NET bindings

Post by demeter »

Hi, i gotten a lot further now...

* I managed to get CMake generate with csharp support (i had to manually configure the SWIG exe (swigwin 4.0.0) in CMakeCache.txt) -> then it worked
* I built the c++ OGRE.sln -> csharp folder
* Building these cs files failed, so i made a .net project and used Visual Studio to see what was going on. I fixed two simple mistakes (an unneeded override and an enum that used uint values but was signed int) -> ogre.dll

But now, lastly, i'm lacking this libOgre.so you speak of. It didn't get generated anywhere, and when I run the built example.cs it complains Unable to load DLL 'libOgre_d', so that makes sense. But I don't know where to get it.

thanks
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

The csharp bindings consist of two parts. The ogre.dll you built and the libOgre.so native Part (probably Ogre_d.dll on Windows).
It should be located in build/lib or the csharp subfolder. Maybe you will have to rename it to libOgre_d.dll
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 5

Re: Building Ogre .NET bindings

Post by demeter »

The libOgre project doesn't build, because OgreOverlay doesn;t build, because it didn't find ft2build.h.

So apparently is from the FreeType library (although the CMake log suggested FreeType was good to go). So, I downloaded freetype (https://github.com/ubawurinna/freetype-windows-binaries), added the include folder and now it gives me linker errors, eg.:

unresolved external symbol _FT_Init_FreeType referenced in function "public: virtual void __thiscall Ogre::Font::loadResource(class Ogre::Resource *)" (?loadResource@Font@Ogre@@UAEXPAVResource@2@@Z) OgreOverlay C:\ogre3d\build\Components\Overlay\OgreFont.obj 1

I can see the mising method names with a texteditor in the freetype.lib, so it's the right library. But when i add them to the library folders in the Visual Studio project, it keeps giving the same linker errors. So, either I include them incorrectly, or it doesnt like something about it...
frostbyte2
Gnoblar
Posts: 16
Joined: Mon Jun 03, 2019 2:45 pm
x 19

Re: Building Ogre .NET bindings

Post by frostbyte2 »

meh, loading precompiled c++ binaries never works...( can be mismatched compiler version, compilation/linker flags etc )
its best to build all dependencies from source with the same compiler env/settings and on the same machine( just to be on the safe side )
that way if anything goes wrong at least you know whats the problem so you can fix it.
afaik ogre build scripts should download all dependencies and build them for you
otherwise https://bitbucket.org/cabalistic/ogredeps
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

Yeah, freetype should have been built in build/Dependencies. Maybe it did Not properly find the debug lib name
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 5

Re: Building Ogre .NET bindings

Post by demeter »

I think I'm almost there now... I can build almost all projects (dlls) of Ogre, and when I copy the build output to the example build output folder, the example starts but crashes when loading the scene. Indeed: dll Plugin_DotScene wont compile yet. (I just ignored it until now because I believed it unneeded for my usecase).

As a matter of fact, only 2 projects with errors remain:

Image

I searched for these identifiers to try fixing the mismatches, but can't find their origin...

If you want me to repost this as a new question, let me know. This is just a "getting the 2 remaining Ogre dlls to build on Windows" problem.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

Something is wrong with your pugixml build. Either disable ogre_tools and dotscene Plugin in cmake or Go Back to the 1.12.1 tag
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 5

Re: Building Ogre .NET bindings

Post by demeter »

It works!

Wow, quite a journey :) Thanks for the help.

I made an extensive blog about the cleaned up process, for my future self and maybe others: https://hellholegames.wordpress.com/201 ... evelopers/

Thanks for all the help!!
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

demeter wrote: Mon Aug 12, 2019 11:51 am I made an extensive blog about the cleaned up process, for my future self and maybe others: https://hellholegames.wordpress.com/201 ... evelopers/
https://github.com/OGRECave/ogre/pull/1242

just updated the devel build to include the C# sources as well. Everything .NET related is now in lib/cli/. Take a look at the latest SDK master snapshot whether this simplifies things for you.
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

Re: Building Ogre .NET bindings

Post by randomcode »

I have to say currently there are too many bugs in the Ogre .NET binding because they are incompatible with MOGRE (edit paroj)
OpenMB(Open Source Mount&Blade Series)
https://github.com/cookgreen/OpenMB
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Building Ogre .NET bindings

Post by paroj »

did you encounter anything else, besides what you reported here?
https://github.com/OGRECave/ogre/labels/SWIG
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

Re: Building Ogre .NET bindings

Post by randomcode »

paroj wrote: Tue Aug 11, 2020 10:54 am did you encounter anything else, besides what you reported here?
https://github.com/OGRECave/ogre/labels/SWIG
I have to say ogre3d .net binding is not usable currently because they are incompatible with MOGRE (edit paroj)
OpenMB(Open Source Mount&Blade Series)
https://github.com/cookgreen/OpenMB
guilherme
Gnoblar
Posts: 9
Joined: Fri Aug 20, 2021 2:00 pm

Re: Building Ogre .NET bindings

Post by guilherme »

demeter wrote: Mon Aug 12, 2019 11:51 am It works!

Wow, quite a journey :) Thanks for the help.

I made an extensive blog about the cleaned up process, for my future self and maybe others: https://hellholegames.wordpress.com/201 ... evelopers/

Thanks for all the help!!
good work! it worked for me!
guilherme
Gnoblar
Posts: 9
Joined: Fri Aug 20, 2021 2:00 pm

Re: Building Ogre .NET bindings

Post by guilherme »

randomcode wrote: Tue Aug 18, 2020 1:49 pm
paroj wrote: Tue Aug 11, 2020 10:54 am did you encounter anything else, besides what you reported here?
https://github.com/OGRECave/ogre/labels/SWIG
I have to say ogre3d .net binding is not usable currently because they are incompatible with MOGRE (edit paroj)
Yeah, I'm trying to migrate a project in Mogre to Ogre 1.13.0.0 with swig, but it's not easy. I hope this work will facilitate future updates. :shock:
Post Reply