Page 1 of 1

Drawing 2D and 3D in the same scene

Posted: Fri Jan 26, 2007 2:35 pm
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?

Posted: Sat Jan 27, 2007 1:30 am
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.

Posted: Sat Jan 27, 2007 9:09 am
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.

Posted: Sat Jan 27, 2007 5:41 pm
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.

Posted: Sun Jan 28, 2007 8:53 am
by Midnight
you have to do 3d in front of the camera... otherwise its 3d drawings in 2d with animation if needed.