PDA

View Full Version : Delphi .Net and Irrlicht



Specis
08-03-2005, 02:32 AM
Hello all,

Its a rather simple question i have, Irrlicht http://irrlicht.sourceforge.net claims to support Delphi via the .net versions and the usage of the irrlicht.net.dll

Now here's the question has anyone actually got this to work from delphi?

I can get the IDE to pickup the namespaces etc but when i try to compile anything with the DLL in the references Delphi just throws strange errors like
[Fatal Error] F1026 File not found: '.dll'
[Fatal Error] E2202 Required package '' not found

or

[Fatal Error] F1026 File not found: '<.dll'
[Fatal Error] E2202 Required package '<' not found

just seems to be random.

Im using Delphi 2005 for this and the irrlicht.net works with C# from within delphi 2005.

Sly
08-03-2005, 03:31 AM
You are venturing into unfamiliar territory there. You're the first I've heard using Irrlicht with Delphi .NET.

savage
08-03-2005, 09:34 AM
Where does you irrlicht.net.dll exist? It could be that it needs to exist in your GAC. The other possibility is to checkl that the irrlicht assembly is for the version of .NET you have installed on your machine.

So much for gettting rid of DLL hell ;).

Specis
08-03-2005, 02:08 PM
Honestly im not sure what you mean by GAC.

But i have the assembly imported as local copy and the DLL exists in the same dir as the source and also a copy in the 'bin\Debug\' Dir for the project

It imports fine, no errors at all. i can browse the clr interface for the DLL all that works fine, The ide will even work with the DLL showing procedures functions etc in the Code Completion.

Its just when you actually try to compile that it throws a slight fit with the above errors.

Same DLL used works with the C# builder built into Delphi 2005 so its kinda a stumping problem.

savage
08-03-2005, 04:09 PM
GAC should be Global Assembly Cache.

I can test it out this evening. What do I need to try it out with Delphi 2005 ( a special Irrlicht installation )??

Specis
08-03-2005, 04:47 PM
Erm you dont, you could try it in Delphi 8, i just have Delphi 2005 is all :D

savage
10-03-2005, 11:34 PM
Did you use something simialar to the following program to test it...

program HelloWorld;

&#123;$APPTYPE CONSOLE&#125;

&#123;%DelphiDotNetAssemblyCompiler '$&#40;SystemRoot&#41;\microsoft.net\framework\v1.1.4322\S ystem.dll'&#125;
&#123;%DelphiDotNetAssemblyCompiler '$&#40;SystemRoot&#41;\microsoft.net\framework\v1.1.4322\S ystem.Data.dll'&#125;
&#123;%DelphiDotNetAssemblyCompiler '$&#40;SystemRoot&#41;\microsoft.net\framework\v1.1.4322\S ystem.Windows.Forms.dll'&#125;
&#123;%DelphiDotNetAssemblyCompiler '..\..\bin\delphi 2005\Irrlicht.NET.dll'&#125;// You will probably have to change this path.


uses
System.Windows.Forms,
Irrlicht,
Irrlicht.Video,
Irrlicht.Core,
Irrlicht.Scene;

var
device &#58; IrrlichtDevice;
texSydney, texWall, texLogo &#58; ITexture;
mesh &#58; Irrlicht.Scene.IAnimatedMesh;
cam &#58; ICameraSceneNode;
node &#58; ISceneNode;
fps &#58; integer;
begin
// start up the engine
device &#58;= IrrlichtDevice.Create&#40;DriverType.OPENGL&#41;;

device.ResizeAble &#58;= true;
device.WindowCaption &#58;= 'Irrlicht.NET Delphi.NET example 01 - Hello World';

// load some textures

texSydney &#58;= device.VideoDriver.GetTexture&#40;'..\..\media\sydney. bmp'&#41;;
texWall &#58;= device.VideoDriver.GetTexture&#40;'..\..\media\wall.bm p'&#41;;
texLogo &#58;= device.VideoDriver.GetTexture&#40;'..\..\media\irrlich tlogoaligned.jpg'&#41;;

// load the animated mesh of sydney

mesh &#58;= device.SceneManager.GetMesh&#40;'..\..\media\sydney.md 2'&#41;;

if &#40;mesh = nil&#41; then
begin
System.Windows.Forms.MessageBox.Show&#40;
'Could not load mesh ..\..\media\sydney.md2, exiting.',
'Problem starting program'&#41;;
exit;
end;

// add a camera, a test scene node and the animated mesh to the scene

cam &#58;= device.SceneManager.AddCameraSceneNodeFPS&#40;nil, 100, 100, -1&#41;;
cam.Position &#58;= Vector3D.Create&#40;20,0,-50&#41;;


node &#58;= device.SceneManager.AddTestSceneNode&#40;15, nil, -1, Vector3D.Create&#40;30,-15,0&#41;&#41;;
node.SetMaterialTexture&#40;0, texWall&#41;;

node &#58;= device.SceneManager.AddAnimatedMeshSceneNode&#40;mesh, nil, -1&#41;;
node.SetMaterialTexture&#40;0, texSydney&#41;;
node.SetMaterialFlag&#40;MaterialFlag.LIGHTING, false&#41;;

// make cursor invisible
device.CursorControl.Visible &#58;= false;

// start drawing loop

fps &#58;= 0;

while&#40; device.Run &#41; do
begin
if &#40;device.WindowActive&#41; then
begin
device.VideoDriver.BeginScene&#40; true, true, Color.Create&#40; 0, 100, 100, 100 &#41; &#41;;

device.SceneManager.DrawAll&#40;&#41;;

// draw the logo
device.VideoDriver.Draw2DImage&#40;
texLogo, Position2D.Create&#40; 10, 10 &#41;,
Rect.Create&#40; 0,0,88,31 &#41;,
Rect.Create&#40; Position2D.Create&#40; 0, 0 &#41;,device.VideoDriver.ScreenSize&#41;,
Color.Create&#40;$ffffff&#41;, false&#41;;

device.VideoDriver.EndScene&#40;&#41;;

if &#40;fps <> device.VideoDriver.FPS&#41; then
begin
fps &#58;= device.VideoDriver.FPS;
device.WindowCaption &#58;= 'Irrlicht.NET Delphi.NET example 01 - Hello World &#91;'+ device.VideoDriver.Name + '&#93; fps&#58;' + fps.ToString;
end;
end;
end; // end drawing-loop
end.


I can confirm that the problem occurs in Delphi 8 ( with all the patches ) as well :((. I have sent the assembly to Borland in the hope that it will help them fix the problem.

Specis
15-03-2005, 12:36 AM
no i went for something simple like just creating the irrlicht device.

But i tried your code there and same thing With Delphi 2005 as with my own code.

I'll await any news you hear and continue to use GLScene atm.

savage
27-03-2005, 01:48 PM
GOOD NEWS!! It appears that Borland have already fixed the problem in Delphi 20005 Service Pack 2 which was released on March the 8th. I have just tested it and it works perfectly with the code I ported and posted earlier.

I hope this helps.

Specis
28-03-2005, 05:44 AM
Nice :)

Had'nt even looked at Delphi 2005 again since trying that :)

Got it working :) nice to have Directx 9 without having to write everything yourself :D

savage
28-03-2005, 01:35 PM
If you are using DirectX 9b managed code, I have ported quite a few of the demos and they are hosted @ http://cc.borland.com/ccweb.exe/listing?id=21147 .

I started work on getting DirectX 9c managed code demos ported ( particularly the new GUI stuff ), but have not had the time to finish them. I think the bug in the earlier version of Delphi 2005, may have also stopped me as well.

Specis
28-03-2005, 02:44 PM
Nice to see Irrlicht 0.9 released directly after i find out its working with Delphi 2005 :D

maybe get this is in the news as it actually works with Delphi now?

savage
28-03-2005, 03:19 PM
I will definately mention it, in the next couple of days.

savage
02-05-2005, 08:51 AM
I have also added the Hello World code to the Irrlicht Wiki @
http://www.irrforge.org/index.php/Tutorials

savage
21-04-2006, 12:55 PM
v1.0 was recently released ( check news item on the main PGD page ).