Gorilla - minimal hud and overlay replacement for OGRE

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

Anyway, I have Captions and LineLists (lists of lines) pretty much done now.

Code: Select all

Gorilla::LineList* list = mCanvas->createLineList();
list->begin(4, Gorilla::webcolour(Gorilla::Colours::HotPink));
list->position(200,200);
list->position(300,300);
list->position(200,400);
list->position(600,500);
list->end(true);

mCanvas->createCaption(10,10, "Some text.", Gorilla::webcolour(Gorilla::Colours::Burlywood));
coco2.png
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

Dropped the "Box" class, Rectangles can now have borders, based of the behaviour and design of the border system you get with HTML and CSS. I'm quite proud of this, I even planned it out on two A4 sheets of paper. ;)
This is Coco, Coco is a Cat. For more information about Coco, Dial "5" on your telephone.
This is Coco, Coco is a Cat. For more information about Coco, Dial "5" on your telephone.
coco3.png (34.45 KiB) Viewed 6077 times
I just need to do the following things, and I'll make a commit of my changes.
  • Re-implement text clipping with a partial option
  • Rectangle gradients
  • Port SpriteLayer renderable to new code
  • Port Text renderable to new code
[Later Edit]

Regular Polygon's can have borders like the Rectangles now. They like the Rectangles don't have to have a fill either:
This isn't Coco.
This isn't Coco.
coco4.png (33.16 KiB) Viewed 6063 times
Next Day Edit

Text alignment!
coco5.png
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

I've done some more changes to the API now. I've added a "QuadList" tool class which is a bit like the Ogre ManualObject, where you can quickly build up something just using simple functions to draw quads, borders, sprites and even glyphs anywhere you like.

The biggest change so far is that I've combined the Canvas, SpriteLayer and Text classes into one; called Layer now. So it's more easier to understand and use.
coco6.png

Code: Select all

// Create Silverback and load in dejavu
mSilverback = new Gorilla::Silverback();
mSilverback->loadAtlas("dejavu");
mScreen = mSilverback->createScreen(mViewport, "dejavu");

// Create our drawing layer
mLayer = mScreen->createLayer(0);

// Create a rectangle with a pink border and no background.
rect = mLayer->createRectangle(10,10,500,100);
rect->border(5, Gorilla::Colours::Pink);
rect->no_background();

// Create a closed line loop.
list = mLayer->createLineList();
list->begin();
list->position(100,100);
list->position(100,200);
list->position(50,200);
list->end(true);

// Create a polygon with coco as the background and a OrangeRed border
poly = mLayer->createPolygon(250,250, 250, 8);
poly->background_image("coco");
poly->border_width(12);
poly->border_colour(Gorilla::Colours::OrangeRed);

// Create a QuadList with various bits in it.
quads = mLayer->createQuadList();
quads->begin();
quads->gradient(100,100,  300,300, Gorilla::Gradient_NorthSouth, Gorilla::Colours::Aqua, Gorilla::Colours::Red);
quads->border(100,100, 300,300, 10,Gorilla::Colours::Pink, Gorilla::Colours::Red, Gorilla::Colours::Blue, Gorilla::Colours::Green);
quads->glyph(100,100, 'A', Gorilla::Colours::BlueViolet);
quads->end();
I was going to release this today, but I there are still some bits need to be finished and I want to rewrite the documentation to include all of these changes. So I'm going to aim for Monday instead.
User avatar
zarfius
Gnome
Posts: 367
Joined: Wed Jan 03, 2007 12:44 pm
Location: Brisbane, Australia
x 13
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by zarfius »

Absolutely awsome as usual betajaen. I'm thinking I might convert it to Mogre sometime.
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by Rambus »

The biggest change so far is that I've combined the Canvas, SpriteLayer and Text classes into one; called Layer now. So it's more easier to understand and use.
I'm happy to hear you decided to make that change, the unified interface should be much easier to work with.
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by rogerdv »

Correct me if Im wrong, but this allow to display text on 3d corrdinates, lets say, on top of entities?
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

Yes, sort of. You'd have to translate those 3D coordinates to screen coordinates (which isn't much of an issue) then move/draw the characters. But everything would be in 2D screen space, rather than directly over someone's head.

Like drawing moustaches on sheets of glass with people behind them. ;)
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by omniter »

Holy! This looks awesome! Great job, betajaen. I want to see Gorilla replace SdkTrays in the next release.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

omniter wrote:Holy! This looks awesome! Great job, betajaen. I want to see Gorilla replace SdkTrays in the next release.
Wow, that's an honour. You could probably keep SdkTrays and just replace the lower-level parts of it with Gorilla, just to keep the API consistent.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by AshMcConnell »

Gorilla looks great! Do you think it would be suitable to use it for a car dash material that could be applied to a mesh? Or is it just for screen space stuff?

Something like: -

Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

Screen stuff, I'm afraid.

Although I suppose it's technically possible to move it into 3D space, I wouldn't know the first place to start. You'd have to translate/orientate all of the rectangles/captions/etc. to the correct position. As it uses the RenderSystem directly, you'd have to draw it in the right order as the rest of the Scene. Urgh, technically possible but it's a lot of work.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by AshMcConnell »

betajaen wrote:Screen stuff, I'm afraid.

Although I suppose it's technically possible to move it into 3D space, I wouldn't know the first place to start. You'd have to translate/orientate all of the rectangles/captions/etc. to the correct position. As it uses the RenderSystem directly, you'd have to draw it in the right order as the rest of the Scene. Urgh, technically possible but it's a lot of work.
Oh well :)

Good to have something do a specific thing well than a jack of all trades. I'm sure i'll use it for something. I thought it might of rendered to texture and then applied the texture to a quad, i'm not sure how UI stuff is normally done.

Thanks!
Ash
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

I did give it another thought.

The base of Gorilla does use the standard vertex buffer classes, if you replace the code RenderSystem specific code with Ogre SimpleRenderable (which uses Vertex Buffers) render code, and add extra code to create the SimpleRenderable and SceneNode, you probably be able to get away with it.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by AshMcConnell »

betajaen wrote:I did give it another thought.

The base of Gorilla does use the standard vertex buffer classes, if you replace the code RenderSystem specific code with Ogre SimpleRenderable (which uses Vertex Buffers) render code, and add extra code to create the SimpleRenderable and SceneNode, you probably be able to get away with it.
Thanks, I'll take a look at the source when I've finished my latest monster refactor (Trying to simplify things) :)
User avatar
MrD
Goblin
Posts: 292
Joined: Wed Oct 21, 2009 3:16 pm
Location: England
x 1

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by MrD »

Nice, I was looking for a way to quickly and easily put up various debug time metrics (FPS, frame utilisation, etc) and I think I've now found a nice way to do that. Good job :)
Insimnax Framework - A game framework for OGRE
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement for OGRE

Post by betajaen »

coco7.png
Okay, the massive update is up. I don't have a change log yet but most of what I've done is been in my last few posts. I recommend everyone who is using Gorilla to switch to this one. It uses less memory, and I think it's a tiny bit faster. It also has way more features.

I haven't ported BetaGUI4 yet to the Gorilla code, but I have done the Ogre Console.

I've documented each class and function, and the API is fairly straight forward to use. But I am writing a small-ish document explaining the features in detail and how Gorilla works, this is a WIP (which I hoped I'd finish today), but you can see it as I work on it at Github page.

Download:

http://github.com/betajaen/gorilla

Future Plans:
- Re-introduce a proper sprite class, rather than using Rectangles or QuadLists.
- Probably the next big change will allow more than 16 layers.
- I'd also like to add borders to Captions and MarkupText
- Possibly have italic, underlined and bold text.
- Praetor convinced me to add RTT support.
- Multiple fonts/sizes per TextureAtlas
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by Praetor »

Couldn't you just use a rendertexture to put this into 3D space? Just activate a rendertexture, render your 2D objects, and then texture any object in the scene with it?

Is this basically an attempt to do cairo-esque drawing operations using only Ogre as a dependency?
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by betajaen »

RTT? Clever, never thought of a using a RTT. It could be easily done too.

Sort of. I don't want it to have the all of the features of Cairo, but some I do want - which it already has. Anyway, we have BetaCairo for that sort of stuff. ;)
Nefbrethilion
Gnoblar
Posts: 24
Joined: Mon Dec 14, 2009 12:15 pm

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by Nefbrethilion »

Hi betajean, I think this is very useful, thanks and congrats!

But I wonder, if it is an overlay replacement, than why don't you put it in Ogre itself (when it's done ofc)? It's fun now to have Silverbacks and the like, but if it is faster than the current system, why not totally replace it? Or do I still miss something here? :-o

Good job in anyway, I'm going to try it out soon!
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by betajaen »

I'm not an Ogre developer, and if I was it would break so many existing applications...
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by CABAListic »

Well, standard procedure with feature replacements would be to have both old and new versions coexist for a major version (or two), but declare the old as deprecated and then remove it, so it wouldn't have to break anything (assuming the naming scheme doesn't overlap). I do think that an improved version of overlays could benefit Ogre, so once you consider gorilla feature-complete and stable, it might be worth thinking about? :)
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by betajaen »

I'm really hesitant to do so. There a few differences between the Overlay system and Gorilla.

- Gorilla uses TextureAtlases, thus one texture/material per "Screen". Overlays do not, and thus can have different materials per quad.
- Gorilla uses TextureAtlases for Glyphs, Overlays use Freetype. Which means Overlays are more flexible about fonts and even font sizes.
- Overlays have a system of hierarchies; One overlay container can be part of another. Gorilla uses a flat structure, so does not have that.
- Overlays have serialisation. Gorilla does not.

What I'd love to see in Ogre is a class or set of classes, similar to my "QuadList". Which is basically a 2D ManualObject, where Quads can be
quickly drawn onto the screen, and removed again at will. I believe that would be a more suitable replacement for the underlying Overlay code, than Gorilla could be.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by CABAListic »

I don't think a replacement system would have to replicate the original Overlays; if I remember correctly the overlays are supposedly a remnant of a failed attempt at an Ogre GUI system (? this was before my time). As far as I can tell they have relatively little use in practice except for a few debug cases, because their rendering isn't exactly efficient, which might lie in some of the differences you point out :)

Of course, gorilla may not be suited to go in whole, but I strongly think a way to quickly and efficiently draw 2D primitives is a very useful feature even for a 3D engine. So yeah, QuadList could be a start.

(Of course I don't want to push you into anything. If you are more comfortable with maintaining gorilla as your separate baby, that's understandable and fine, too :) )
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by betajaen »

No, it would be an honour to write code for Ogre. I'm just pointing out that Gorilla and Overlays have their differences, which are far apart that some people may be put off and rather have an Overlay system than use Gorilla.

An efficient 2D ManualObject class would be brilliant for Ogre to have, couple that with a standardised Texture Atlas system and file format so the user can make use of low batching techniques. I feel it would be a good replacement. I think some people would be a bit upset on how low-level it would be, but would probably get over it. I also think that GUI systems such as CEGUI or QuickGUI could make use of it as a rendering interface. Praetor mentioned RTT in a few posts back, this 2D ManualObject could use that thus CEGUI and QuickGUI instantly have GUIs put on the sides of surfaces and meshes.

I don't mind the direction Gorilla takes. Originally it was going to be a simple bit-blit class that would copy pre-rendered bit mapped fonts (from a char array) onto a Texture which was displayed via an Overlay, this was for my game I'm working on. Jacmoe inspired me to go the Quad route and here we are and I can still use Gorilla in my game, I have that code now. What direction it takes is fine.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: gorilla - minimal hud and overlay replacement. UPDATED!

Post by CABAListic »

Sounds great :)
I'm currently writing a small little game engine for Python for which I hope to get to the GUI part in the next few weeks. Once I do, I will take a very close look at gorilla, and then perhaps we could discuss a few concrete ideas what and how could go into the Ogre core.
Post Reply