OgreDotNet AND VS2005 Team Edition (Pro is the same)

marc_antoine

29-12-2006 00:35:12

hey peps, i have been struggling with OGREdotNET for almost 2 days :S and i have to say thank you to all the posts here and there that i found that in someway helped me making ogre run in c# so i want to make a contribution here.

i was one of many that encountered lots of problems and perhaps the many info in the forum the only problem seems to be that the info is mixed and we end mixing steps so what i present here are the steps i did in order to succesfully :

1.- Build the DLL's
2.- Compile and Run the first Tutorial

also if someone has a place where i could upload a word document or a video showing the step by step im describing here (we ll know that a screenshot worth a thousand words)

ok...lets get our hands dirty!! :D




Building DLL's
-------------------------------------------------------------------------

you must download and install the prerequisites listed here:
http://www.ogre3d.org/wiki/index.php/Og ... quirements

HIGHLIGHTS FOR THIS PART

- In that URL lists 2 CV's i used turtoise (i had any experienacie with a CVS before so i tried turtoise and i found it really easy to use but u can use the one tht fits you)

- Swig (the wrapper for the c++ dll's) doesn't have an installation so unziping it is enought, my recomendation is unzip swig in a folder in the root of your OS filestructure (E.G C:\SWIG).

also remember to create the environtment variable (sorry my english)

-For the SDK use the 1.2.0 version(OgreSDKSetup1.2.0_VC80.exe) not the newest (OgreSDKSetup1.2.4_VC80.exe) i haven't tested or try to build the dll's with the newest version but telling by the posts i found the v 1.2.4 is not supported or fully supported yet.

u can download the v 1.2.0 from here:
http://sourceforge.net/project/showfile ... ge_id=2939


ok install the SDK and when done installing the SDK, unzipping the SWIG program and creting the environtment variable and installing turtoise, restart the computer IS A MUST!!


after restarting the PC is time to get the OGREDOTNET stuff here are the instructions:
http://www.ogre3d.org/wiki/index.php/Getting_OgreDotNet

for turtoise what i did was get to the root ( in my system it is c:\ ) right click the mouse and selected CVS Checkout, then i fed in the info that appears in the previous URL. and strted downloading the files.

once "ogreaddons" repository is downloaded open the "OgreDotNet.sln" inside "ogreaddons"; OgreDotNet.sln is a solution tht is in VS2003 so double click this file and the vs2005 conversion wizard will show and prompt you to convert the project, this is a really stright forward procedure where the only option is to save a backup (you can backup or not is up to you i just did a zip before doing any conversion or compilation).

at this point if you check the report of the conversion you will se tht there were some warnings, well just ignore them since they are making reference to some c# files that are not there cose the project has not been builded yet.

just close the report, and here comes some tricky stuff.



BUILDING THE PROJECT
-------------------------------------------------------------------------

if you just right click the solution header nd select build or rebuild solution, VS will strt kicking nd yelling and complaining and start throwing all kinds of FU$#%&$%&s.....)/()()/(7/&%"!"# heheehe well not all that but almost this is for 2 reasons:

1.-you have to copy some HEADER files (*.h files) in the SDK directory
2.-and becouse the endings of some header files in the project has the mac format...¬_¬ Mac format!? ,,,sad but that is what the compiler says anyway the compiler will say it is love confusing it with a stomachade ( sorry my english again i dont have a dictionary near to me :S)

let's give a solution to this ...
before we begin fixing this, please build the project if u haven't do so...

alright now to the dirty work....first of all kickout the gangstas projects that are in the solution, this si becouse if you don't have the gansts wrapper for physics engines the solution wouldn't compile succesfully and by the moment they seems not to be necessary for start doing things in ogre right now, and perhaps you can comeback and open the ganstas project and compile them so you can get the dll's later.

ok according to this post we hve to copy some files..
http://www.ogre3d.org/phpBB2addons/view ... e8b52079a1

the URL says that The headers you need are in

ogresdk/samples/include/

just copy them to

ogresdk/include



the files to copy are:

OgreCEGUITexture.h
OgreCEGUIResourceProvider.h
OgreCEGUIRenderer.h

alright and now for every error that makes a reference to an errar related to Mac file format just double clic the error and a will pop a window asking you to repair the format, just click yes, you must do this with every header in the solution, if u missed a header the compiler will show the same error for every heder you missed, just repeat the same procedure until no error pops.

when finish building the solution you will get alot of warnings that comes from swig program (the wrapper) it is ok just ignore them.

NOTE: this is really important notice how are you building the solution , is it as building ? or RELEASE?

my experience is building everything as release... but if you choose debug is ok, just remember you are building everything with the debug profile, this info is important in the following steps.

depending on the profile you selected some libraries and other files will be at:
C:\ogreaddons\ogredotnet\Bin\Debug

or

C:\ogreaddons\ogredotnet\Bin\Release

well we haven't finish yet, just stay with me alright?....ok, csave everything, and close the solution, then open it again, depending of the VS2005 maybe it will show the conversion wizard, it is ok, just hit next and finish, this time no errors or missing files will appear in the report since they are now there :), after removing the gangstas projects from the solution ther are 21 projects in the solution now we have to manually build the following projects :

-MATH3D
-OgreNet
-OgreNet.CeguiRenderer
-CeguiNet

follow the same order of the list, to build just right click the project and select build (remember to build them using the same profile that you used the first time either Debug or Release my advice is always build using Release)

After that there should be 7 dll's in

C:\ogreaddons\ogredotnet\Bin\Debug
or
C:\ogreaddons\ogredotnet\Bin\Release

plus some configuration files that we will be editing later.

now create a new c# console solution, and copy& paste the code of the first tutorial.

before building it succesfully we need to copy some the dll's we built nd the dll's from the OGREsdk, since our dll's are wrappers for the ones in the SDK they need to be where they can be found.

so configure the solution to compile in release mode, and in the Bin\Realese directory of our application copy the 7 dll's and the configuration files from Bin\Release directory of the ogredotnet, (look i'm choosing release version not debug version, if you configured the application to build as debug then copy the ones from Bin\Debug...)

and now copy all the dll's and media.cfg from Bin\Release (same as above i'm copying all the files from release since i lways worked with release) from the directory of the ogreSDK to our Bin\Release folder.

now in the c# project Release directory wehere we are copying the dll's nd the *.cfg files crete a folder nomaed "Samples" inside that derecotry create nother folder named "Media" (case sensitive, but if you used other names you will need to change the names in the *.cfg (configuration files) it is not a big deal doing that)

to the "Media" folder we just created , copy the contents of the "...\ogredotnet\Samples\Media\" directory

finally copy the "media" directory from the OGRESDK directory to the bin\Release directory ..



WE ARE ALMOST FINISHED!!!!! hold on!!!!

finally we edit the configuration files (*.cfg) actually is only one, the one we are going to edit, the file is: Resources.cfg

this is the content of my Resources.cfg, you can erase the contents of yours and paste this..:


# Resource locations to be added to the 'boostrap' path

# This also contains the minimum you need to use the Ogre example framework

[Bootstrap]

Zip=media\packs\OgreCore.zip



# Resource locations to be added to the default path

[General]

FileSystem=media

FileSystem=media\fonts

FileSystem=media\materials\programs

FileSystem=media\materials\scripts

FileSystem=media\materials\textures

FileSystem=media\models

FileSystem=media\overlays

FileSystem=media\particle

FileSystem=media\gui

FileSystem=media\DeferredShadingMedia

Zip=media\packs\cubemap.zip

Zip=media\packs\cubemapsJS.zip

Zip=media\packs\dragon.zip

Zip=media\packs\fresneldemo.zip

Zip=media\packs\ogretestmap.zip

Zip=media\packs\skybox.zip



FileSystem=Samples\Media
#FileSystem=C:\ogreaddons\ogredotnet\Samples\Media



#To use GangstaDotNet, correct the path and uncomment the line below

#FileSystem=@GangstaWrapper@\..\Gangsta_Ogre\Samples\Media


-----------------------------------------------------


basically the modification is to make the path relative to our application, we save the file, and close the file.



alright now compile and build the project and voila! tht's it...


hope this helps, hope to upload screenshots somewhere or video is alot more easy to follow than written instructions, ..

:wink: