2D Graphics?


16-01-2008 12:51:39

How do I draw 2D graphics in Mogre? Like, say, a HUD?


16-01-2008 14:37:15

Look for key words overlay and gui.

Here is a GUI overview:

What is a HUD?


16-01-2008 20:02:48

From wikipedia:

The HUD, short for Head-Up Display, is the method by which information is visually relayed to the player in computer and video games. Gaming developers often erroneously refer to the HUD as the "Heads Up Display" possibly based on the expression "Heads Up!" to call attention to an incoming projectile. The HUD can be an important part of a game's user interface.

Taking its name from the real-life version, the HUD is frequently used to simultaneously display several pieces of information including the main character's health, items, and an indication of game progression (such as score or level).


16-01-2008 21:54:20

I don't need a gui system, I need a way to draw sprites...


17-01-2008 22:28:53

I also would need something like this for display of the cardinal point for a compass.

This is possible using overlays (basic 2D objects). There you integrate a material. The material file refers to a picture file of a ghost.
A GUI system works similar work like this and could be used for that, too. (ok, instead of overlays a gui system also could based to 3D objects)
So the theory - in practice I found no ready solution for Mogre and have still not enough knowledge to do it myself.

Search in the forum or wiki for "overlay" Ogre code and try to port it. Maybe there is also running example code for Mogre or OgreDotNet. If you installed the program Tortoise you can get all the sources from CVS or subversion system including examples.

An other way is to build / import a 3D ghost mesh. Then add a SceneNode to the SceneNode of the current Camera. On this you can add the ghost entity. By changing the position and scale you can put it into a screen corner. When you move the camera the ghost should be fixed at this position (as long as you don't change the aspect ratio or camera settings of the viewport).

Sorry, more I can't help. But if you get a solution with overlay, I would be happy if you post the code.


20-01-2008 13:19:03

I searched for some information.
This here should help you.

How to create an overlay:
(the first snippit is enough I think - just adapt it)

Maybe also read the sections 3.4.1 OverlayElement Attributes and 3.4.2 Standard OverlayElements (linked on the bottom).

How to create a material including your HUD graphics you can read here:

How to create an overlay without ressource files you can see in this example code. Maybe you have to make some little changes, but the OgreDotNet code should be similar:
www.ogre3d.org/wiki/index.php/OgreDotNe ... xt_overlay

Information for using overlays are in the Ogre API:
www.ogre3d.org/docs/api/html/classOgre_ ... ement.html
www.ogre3d.org/docs/api/html/classOgre_ ... ement.html
www.ogre3d.org/docs/api/html/classOgre_ ... ement.html
www.ogre3d.org/docs/api/html/classOgre_ ... ement.html

Also search for subclasses with keyword "OverlayElementCommands" in
(in Firefox you can "Highlight all" searching results, what is very nice + helpful)


20-01-2008 16:16:06

Take a look to ManualObject class, with this you can build geometry in memory, like 3D meshes, or 2D object (sprites). An example in:


PD: That is Ogre related, but is easy use it the same in MOGRE.


21-01-2008 23:13:43

Additionally here is a snippit how to get the viewport/screen position of a point in 3D space. This could be needfull for your HUD.
If somebody port it to Mogre, please post it (or write a message to me) and I will add it into the Forum.
(this simple code I could port, but I'm to lazy ;-) )

www.ogre3d.org/wiki/index.php/Projectin ... size_to_2D


13-02-2008 15:16:13

I heard of something called Ogre Magic, designed to make it eaasier to make 2D graphics with Ogre. I guess it's not available for Mogre though...


14-02-2008 02:27:52

Can I see a link to Ogre Magic? This looks interesting....


16-02-2008 12:56:42