Drawing 2D and 3D in the same scene

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Drawing 2D and 3D in the same scene

Post by pin3 »

I did took a look at the 2D graphics tutorial however I would like not to use sprites. I'm need 2D graphics for mouse cursor and other GUI controls Is there a way to use 3D objects and flatten them out with an Ortho projection?
KG
Posts: 35
Joined: Wed Jun 07, 2006 12:00 am

Post by KG »

You can use the addImage function of IGUIEnvironment for doing 2D interface graphics. It works quite well for things like HUDs.

You can use the draw2DImage function of IVideoDriver for the cursor. You need to use it after the GUI and scene have been drawn, but before everything is drawn on the screen, or else it will be drawn on top of.

As for doing all this with 3D instead of 2D images, I don't know. There might be a way to use render textures to do that.
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

Thanks!

addImage works pretty well, I like it better than using sprites. Ther's still a problem though: with AddImage you can't specify the depth (Z) of the image on the run, after you loaded the images.

[EDIT] Actually just noticed GUIImage has a BringtoFront method, I'll take a look see how that works.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The 2D functions do not have a z-depth and I believe that the z-buffer is disabled when the those functions are called.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

you have to do 3d in front of the camera... otherwise its 3d drawings in 2d with animation if needed.
Post Reply