Hello,
I'm making currently a 2D game. I saw Irrlicht has the wonderful Draw2DImage function, however it's too simple for my needs. I need rotation, scaling, etc. which I didn't saw in Irrlicht. So I decided to go 3D and simply make a plane at 0 depth, filled with rectangles (made of 2 triangles each) and applying textures to each. I did actually succeed in making the object, the camera, etc, however few questions remained after 2 days of reading by now.
0. My main loop is simply
drv.BeginScene(true, true, new Color(255, 255, 255, 255));
scm.DrawAll(); // scm is the scene manager
drv.EndScene();
However, after a few seconds, the objects on the scene disappear, and after few more - the app crashes, the reason - unknown.
1. How exactly must my objects be placed and the camera located, so for example at 800x600 I can fill the whole screen with a plane at 0 depth, the whole plane in the screen and nothing except the plane on the screen.
If anyone needs code (it's C#.NET with Irrlicht.NET CP) I can upload it to my server.
Thanks in advance...
A few fairly noobish questions about 2D -> 3D
Thank you for your fast reply...
This code may be a little unfinished, unstructured or wrong, but it's all I could assemble for now...
http://allisdesign.com/Program.cs
As you can see, it's all in one try-catch, the console on my computer prints nothing and it simply crashes (send/don't send error report). It's verry strange...
As for the camera - I was asking if there could be some kind of formula or something more "standard" - not just trial and error, but it's fairly OK for now.
All the console says is:
Irrlicht.NET CP v0.8.1.0 running
Irrlicht Engine version 1.3.1
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Using renderer: OpenGL 2.0.3
GeForce 7600 GS/PCI/SSE2/3DNOW!: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
Loaded texture: img/grass.png
I think I have the latest drivers, etc. I think you pros can figure it out from the code...
This code may be a little unfinished, unstructured or wrong, but it's all I could assemble for now...
http://allisdesign.com/Program.cs
As you can see, it's all in one try-catch, the console on my computer prints nothing and it simply crashes (send/don't send error report). It's verry strange...
As for the camera - I was asking if there could be some kind of formula or something more "standard" - not just trial and error, but it's fairly OK for now.
All the console says is:
Irrlicht.NET CP v0.8.1.0 running
Irrlicht Engine version 1.3.1
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Using renderer: OpenGL 2.0.3
GeForce 7600 GS/PCI/SSE2/3DNOW!: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
Loaded texture: img/grass.png
I think I have the latest drivers, etc. I think you pros can figure it out from the code...
Well, I did manage to deal with the crash, I changed few things and then it suddenly started working. The question about the camera position still remains. I turned out that if you want to view the full plane on 800x600 window (the plane i 800x600 on depth 0) you have to put the camera at something like -413. That's pretty strange so I thought there must be something better than to use binary search by yourself to find out... it doesn't seem too professional!
I'm still a bit of an Irrlicht/3D in general newbie myself, but I think maybe what your looking for might be the function "setRenderStates2DMode()." That appears to be the function that makes the Driver->drawImage2D() function work, and from what I can tell once it's set it makes one unit roughly equal to a pixel.
Also, reading the Irrlicht source for the 2D drawing and GUI functions might help you as well.
Also, reading the Irrlicht source for the 2D drawing and GUI functions might help you as well.