Welcome! Log In Create A New Profile

Advanced

Mixing 3D and 2D in one scene?

Posted by AerialX 
Mixing 3D and 2D in one scene?
August 26, 2008 07:42PM
So let's say I have a 3D scene going in GX; so far so good. Now, I want to draw 2D graphics on the screen on top of this. Say a HUD of some sort, a Lives Left indicator, doesn't matter what. So what's the best way (or any way, for that matter) to do this?

The only solution that comes to mind for me is allocating an extra framebuffer for GX, then using that as a texture in the ortho view. Or switching to ortho view halfway through drawing (is this possible?). Anyway, I'd just like to know how this should be done. Also, if mixing it with libwiisprite is possible that would be nice too.
Re: Mixing 3D and 2D in one scene?
September 02, 2008 12:39PM
Switch to orthogonal/perspective on-the-fly, as needed.
Re: Mixing 3D and 2D in one scene?
September 03, 2008 02:58AM
Eluan: Thanks for the response. I wasn't sure if that would work at first (why I asked), but I did eventually try that a few days ago and managed to get libwiisprite to render perfectly over a 3D scene :)
Re: Mixing 3D and 2D in one scene?
November 29, 2008 09:06PM
Hi, i'm trying to show a hand cursor over my perspective scene, using regular openGL tutorials, and failing miserably...

anyone kind enough to point me to the right way?
Re: Mixing 3D and 2D in one scene?
November 30, 2008 02:13AM
Draw your 3d scene, then set to the orthographic projection and then, draw quads with z = 0 like you would on 3d.

In my library:
/**
* Set the 2D projection here and draw the 2d objects on it
*/
rs->setDepthTest(false);

rs->setMatrixMode(MATRIXMODE_PROJECTION);
rs->pushMatrix();
rs->identityMatrix();
rs->setOrthographic(0, rs->getScreenWidth(), 0, rs->getScreenHeight(), -1, 1);

rs->setMatrixMode(MATRIXMODE_MODELVIEW);
rs->pushMatrix();
rs->identityMatrix();

for (std::list::const_iterator dit = m2DObjects.begin(); dit != m2DObjects.end(); ++dit)
{
drawable2D* obj = (*dit);
assert(obj != NULL);

obj->draw();
}

Check the functions on:
[code.google.com]
Sorry, only registered users may post in this forum.

Click here to login