Gorilla - minimal hud and overlay replacement for OGRE
-
Dark_Oppressor
- Gnoblar
- Posts: 5
- Joined: Mon Apr 11, 2011 9:30 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I've been working on a roguelike recently. In case you don't know, roguelikes typically just use ascii characters as graphics. I've been using my own 2D engine with a bitmap font to simulate ascii graphics for my roguelike. I just started learning to use OGRE, which is also my first experience with anything 3D.
Yesterday, just for fun, I used my new OGRE test engine + Gorilla to run my roguelike as an overlay on the 3D stuff. It actually works really well, but I'm having one little problem.
The font is not as sharp as the same bitmap font loaded in my 2D setup. My best guess is that either OGRE loads .png's differently than I usually do, and this is causing it, or that Gorilla is trying to "smooth" the font or something. What I want is the bitmap font I already have to be stuck on the screen exactly as it is. Could this be a Gorilla thing, and if so, how can I get what I want?
Yesterday, just for fun, I used my new OGRE test engine + Gorilla to run my roguelike as an overlay on the 3D stuff. It actually works really well, but I'm having one little problem.
The font is not as sharp as the same bitmap font loaded in my 2D setup. My best guess is that either OGRE loads .png's differently than I usually do, and this is causing it, or that Gorilla is trying to "smooth" the font or something. What I want is the bitmap font I already have to be stuck on the screen exactly as it is. Could this be a Gorilla thing, and if so, how can I get what I want?
-
zarfius
- Gnome
- Posts: 367
- Joined: Wed Jan 03, 2007 12:44 pm
- Location: Brisbane, Australia
- x 13
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I'm not sure what Gorilla does but Ogre materials tend to have trilinear filtering mode on by default. I'd start by taking a look at your materials.Dark_Oppressor wrote:The font is not as sharp as the same bitmap font loaded in my 2D setup
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
http://www.craftworkgames.com/
-
smartwhiz
- Gnoblar
- Posts: 5
- Joined: Tue Apr 12, 2011 7:39 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Hello everyone,
Thanks to the community, Gorilla is a really strong addon to the OGRE addons. Just a quick query though as I was testing out the integration of Gorilla with a small project of mine.
Why does when I have a scene with nothing, absolutely nothing in the scene except a 3 layers texts on a single gorilla screen, the number of batches show as zero? Well if its Gorilla draws everything in 1 batch(hope I am not confusing batch with drawcalls) then there should be atleast 1 right?
In the Image
1. Layer for FPS, Batch and Mouse X/Y text
2. Layer for Mouse Pointer (5X5 white pixels in screen)

And with an OgreHeadMesh, the batches jump to a 5 (guessing that batches for ogrehead.mesh are 1 for the mesh and 4 for the textures)

Please correct me if I am wrong somewhere.
Thanks to the community, Gorilla is a really strong addon to the OGRE addons. Just a quick query though as I was testing out the integration of Gorilla with a small project of mine.
Why does when I have a scene with nothing, absolutely nothing in the scene except a 3 layers texts on a single gorilla screen, the number of batches show as zero? Well if its Gorilla draws everything in 1 batch(hope I am not confusing batch with drawcalls) then there should be atleast 1 right?
In the Image
1. Layer for FPS, Batch and Mouse X/Y text
2. Layer for Mouse Pointer (5X5 white pixels in screen)

And with an OgreHeadMesh, the batches jump to a 5 (guessing that batches for ogrehead.mesh are 1 for the mesh and 4 for the textures)

Please correct me if I am wrong somewhere.
-
Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
What do you think about generating the atlases at runtime like canvas does?betajaen wrote:So, I had a bit of a sit down and thought out the plan a bit more. This is a copy of my notes and TODO list.
The things that have been crossed out, have been completed, or partially completed.
I suppose Gorilla 2.0 can be clumped into three parts; Merging into the Ogre Codebase as a proof of concept, Additions to Gorilla, Support/Documentation.Gorilla 2.0 Plans and Ideas
===========================
Gorilla.h/Gorilla.cpp
- [s]Use Ogre namespace.[/s]
- [s]Merge WebColours into Ogre::ColourValue[/s]
- Gorilla class replaces Silverback.
- Display/MovableDisplay replaces Screen/ScreenRenderable
- Text, Line, NGon, Rectangle, etc. all prefixed with Displayed
- GorillaFile class with API, accesible through the Ogre ResourceSystem. Acts just like a Resource. Behaves a bit like a material.
- Font's now called GlyphSets. Unicode support?
- Animated Sprite support.
Documentation
- Documentation on Wiki, or on Github?
- Tutorial
- Integration into Ogre article. Proof of concept as a Component.
Editor
- Editor for Gorilla
- Uses Gorilla for the interface
- Use the existing demo framework.
Demos
- More demos, based on tutorials. Setup, etc.
- Each demo is about a particular feature.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
No your right.smartwhiz wrote: And with an OgreHeadMesh, the batches jump to a 5 (guessing that batches for ogrehead.mesh are 1 for the mesh and 4 for the textures)
Please correct me if I am wrong somewhere.
But I'm calling the RenderSystem::_render function, skipping over any Scene intermediary functions which I imagine would have code to update the Scene statistics. It is one batch, it's just Scene doesn't know about it.
@brocan
The GorillaFile class will allow you to make TextureAtlases in code, packing them is simple box packing. I really don't want to add code that may be used or once or twice by some one. If you want, when it's released, you can post a function on the Wiki that will do it for you; utilising the GorillaFile class.
-
Dark_Oppressor
- Gnoblar
- Posts: 5
- Joined: Mon Apr 11, 2011 9:30 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I'm not sure what Gorilla does but Ogre materials tend to have trilinear filtering mode on by default. I'd start by taking a look at your materials.[/quote]
Thanks! I figured it out. As per one of the tutorials, I was setting the default number of mipmaps to 5. I changed this to 0, and the font looks perfect.
Thanks! I figured it out. As per one of the tutorials, I was setting the default number of mipmaps to 5. I changed this to 0, and the font looks perfect.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Gorilla uses two materials per texture.
- Gorilla2D.texture_file_name.extension
- Gorilla3D.texture_file_name.extension
-
zarfius
- Gnome
- Posts: 367
- Joined: Wed Jan 03, 2007 12:44 pm
- Location: Brisbane, Australia
- x 13
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Wait.. should that be Gorilla2D.fonts.png instead? If that's the case it might be a bit misleading because the filename looks like an image but contains a material script. Wouldn't it be more logical to be named Gorilla2D.fonts.png.materialbetajaen wrote:The way the code works is, you can pre-create the material beforehand and Gorilla will use it; So if your texture is called "fonts.png" then the Material would be called "Gorilla2D.fonts.ping". Feel free to write the material in how you wish it to be.
Or maybe I'm missing something completely.
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
http://www.craftworkgames.com/
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
No, not really.
Material names don't have to end with '.material', your probably confusing it with the file extension.
Material names don't have to end with '.material', your probably confusing it with the file extension.
-
zarfius
- Gnome
- Posts: 367
- Joined: Wed Jan 03, 2007 12:44 pm
- Location: Brisbane, Australia
- x 13
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Ah, I see where your coming from now. I thought you were talking about the filename of the material.betajaen wrote:Material names don't have to end with '.material', your probably confusing it with the file extension.
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
http://www.craftworkgames.com/
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
@betajaen
I have problems with the way goriall is rendering the atlas.
First you create the base materials Gorilla2D /Gorilla3D then for every atlas you clone the material and cache the pass (m2DPass/m3DPass) then you set the pass here => mSceneMgr->_setPass
and then you call somewhere RenderSystem::_render.
So this approach works with fixed function but not on RS which does not support FF like the GLES2 for example (iOS).
Now i can here someone says :"Just write a material with vertex/fragment shader and name it Gorilla2D" yeah i did this and it failed
The reason is that the GpuProgram is never loaded (due the fact gorilla bypass almost every system in Ogre
) so what i try now is to load the gpu resource manually but i do not think this approach is good for your V2 of gorilla or did you change this already?
Edit:
Patch one post below...
I have problems with the way goriall is rendering the atlas.
First you create the base materials Gorilla2D /Gorilla3D then for every atlas you clone the material and cache the pass (m2DPass/m3DPass) then you set the pass here => mSceneMgr->_setPass
and then you call somewhere RenderSystem::_render.
So this approach works with fixed function but not on RS which does not support FF like the GLES2 for example (iOS).
Now i can here someone says :"Just write a material with vertex/fragment shader and name it Gorilla2D" yeah i did this and it failed
The reason is that the GpuProgram is never loaded (due the fact gorilla bypass almost every system in Ogre
Edit:
Patch one post below...
Last edited by Wolfmanfx on Thu Apr 14, 2011 9:22 pm, edited 1 time in total.
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
So i patched gorilla to load the gpu resources and also wrote GLSL/HLSL shaders + materials so gorilla can be used without FF. (Everything is attached)
Next step are the glsles shaders which i have to test first.
Next step are the glsles shaders which i have to test first.
You do not have the required permissions to view the files attached to this post.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Okay, if you don't have any issues with it. I'll put it in during the weekend.
[Edit]
I know absolutely nothing about shaders what am I supposed to do with these?
[Edit]
I know absolutely nothing about shaders what am I supposed to do with these?
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Np
I will post the gleses shaders here if i got gorilla working with the gles2 rs
I will post the gleses shaders here if i got gorilla working with the gles2 rs
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Can you contact me via icq/aim or msn?
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I'm on Steam and that's it. I'm in the Ogre Steam group under Betajaen or Robin.Wolfmanfx wrote:Can you contact me via icq/aim or msn?
-
spacegaier
- OGRE Team Member

- Posts: 4308
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 137
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
And then there is still Ogre IRC BRAND NAME for real time communications
.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
So i added the shader based gorilla materials now its also working on iOS (GLSLES 2 RS) -> https://github.com/betajaen/gorilla/com ... 6a9dd591de
(I also forgot to add my username during push
sorry betajaen)
(I also forgot to add my username during push
-
smartwhiz
- Gnoblar
- Posts: 5
- Joined: Tue Apr 12, 2011 7:39 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I would like to ask a quick question on this, couldn't find much on it. What if I want to use multiple pngs? Like 2 for fonts, another one for a set of buttons pointers etc?
EDIT :
. But I can wait
.
EDIT :
AH just got the post, it's only awaitedbetajaen wrote:I don't like bumping old posts for no reasons. But I decided on another new good feature which please a lot of people.
I think people will like it.- Multiple textures per Gorilla File. Fonts and Sprites can be spread across this. Ideally, total number of batches should be the total number textures used.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Thing is, you can have multiple fonts, many pointers, sprites now. Just use a bigger texture.
Even if I do implement it; it's still won't be as efficient, because of the extra batches.
Even if I do implement it; it's still won't be as efficient, because of the extra batches.
-
smartwhiz
- Gnoblar
- Posts: 5
- Joined: Tue Apr 12, 2011 7:39 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
I guess extra batches are ok, as long as its clearly being recorded on the global batch count. As long as the developer has the control on the number of batchs (directly related to the number of pngs used) I guess its ok. But having a big texture not that preferred because at certain areas of game/application I would need only say 40-50% of the png but still the image is completely loaded on the memory can be a pain.
Hope I am making sense.
Hope I am making sense.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
You are, but bare in mind you can put multiple fonts and cram in as much sprites into a single texture as possible. Only resize the texture when needed. As with most things it's trade off between memory or processing time.
-
al086
- Gnoblar
- Posts: 9
- Joined: Thu Mar 10, 2011 6:06 pm
- x 1
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Hi, everyone.
My friend and I have nearly finished the gorilla files. We've quickly tested it, and corrected the main issues.
The main upgrade we've brought to gorilla is to use several png files (several Texture Atlases) at the same time, and on the same screen (and therefore on the same batch).
We've also brought several useful methods, such as to change a layer's index (making that layer appear over or under another layer), or rotate a rectangle (that means rotate a sprite, as some have been requesting).
Please test our version, and don't hesitate to tell us of eventual bugs.
He haven't worked on some things such as 3d sprites. We don't even know if it works.
For betajaen : here's a file with most of the modifications we've made to the code.
My friend and I have nearly finished the gorilla files. We've quickly tested it, and corrected the main issues.
The main upgrade we've brought to gorilla is to use several png files (several Texture Atlases) at the same time, and on the same screen (and therefore on the same batch).
We've also brought several useful methods, such as to change a layer's index (making that layer appear over or under another layer), or rotate a rectangle (that means rotate a sprite, as some have been requesting).
Please test our version, and don't hesitate to tell us of eventual bugs.
He haven't worked on some things such as 3d sprites. We don't even know if it works.
For betajaen : here's a file with most of the modifications we've made to the code.
If you want other modifications, tell us and we'll add it to our "To do" list..h 121- struct NameFileAndPosition
.h 143- enum Gradient >> Gradient_Diagonal_1,Gradient_Diagonal_2
.h 324- modified (add Ogre::String* NameFile)
.h 331- Add struct Vertex2 = old struct Vertex
.h 398- Add in sprite Ogre::String mNameFile;
.h 468- Add method TextureAtlas* getatlas(const Ogre::String& NameFile)
.h 677- Add void setTexture(Ogre::TexturePtr newTexture)
.h 741- moved out of class layerContainer : struct IndexData : public Ogre::GeneralAllocatedObject
.h 757- create std::map<Ogre::uint, IndexData*>* GetMapIndexData(); //(for change index of layer)
.h (old 747)- delete getAtlas of LayerContainer
.h 853- add std::vector<NameFileAndPosition> VectorTextureByVertex;
.h (old 851)- delete mAtlas
.h (old 861)- delete friend class layer;
.h 1213- add parameter in constructor : NameFile (quadlist)
.h 1241- add parameter in constructor : LeNameFile(caption)
.h 1268- add parameter in constructor : NameFile (markuptext)
.h 1300- add method void setIndex(Ogre::uint); (layer)
.h 1308- modified all methods _getNameMethod , example : (return mParent->getAtlas()->getWhitePixel();) to (return Silverback::getSingleton().getatlas(NameFile)->getWhitePixel();) and add a parameter like this : inline Ogre::Vector2 _getSolidUV(const Ogre::String& NameFile) const
.h 1616- modifier background_gradient in class rectangle
.h 1660- background_image(Sprite* sprite) took NameFile of sprite to put it in rectangle
.h 1744- background_image(const Ogre::String& sprite_name_or_none, Ogre::Real widthClip, Ogre::Real heightClip,const Ogre::String& NameFile) add NameFile for methods background_image
.h 1965 add GetNameFile and SetNameFile in rectangle
.h add Ogre::String mNameFile; in rectangle
.h 1958 add methods : void rotateDeg(Ogre::Real, Ogre::Vector2 centre);
void rotateRad(Ogre::Real, Ogre::Vector2 centre);
Ogre::Real getDegRotAngle();
Ogre::Real getRadRotAngle();
bool getCustomRotCenter();
void setCustomRotCenter(bool);
The same change (background-image and GetNameFile and SetNameFile) for polygon and other classes
.h add Ogre::String mNameFile; in polygon
.h 2553 modified font in caption
.h in caption add position and setIndex
.h 2881 add Ogre::Real Textwidth()
.cpp- modified all define PUSH_VERTEX and all
.cpp121- modified TextureAtlas::_load
-cpp 369- TextureAtlas::_loadSprites
we have modified the method "redraw" of each 2d object in order to precise the name of the file to use for the texture when the vertex buffer is created.
We have also modified the method "_renderVertices" and "_renderOnce".
You do not have the required permissions to view the files attached to this post.
-
smartwhiz
- Gnoblar
- Posts: 5
- Joined: Tue Apr 12, 2011 7:39 am
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
Hey al086,
I have been writing a small game with the last build of Gorilla, checking your version right away and will be right back commenting on the compatibility.
[EDIT]
Could you please give a tutorial on the usage? Because on my StateMachine, I am unable to check it and its crashing. Probably if you could give a code snippet on I can check precisely.
I have been writing a small game with the last build of Gorilla, checking your version right away and will be right back commenting on the compatibility.
[EDIT]
Could you please give a tutorial on the usage? Because on my StateMachine, I am unable to check it and its crashing. Probably if you could give a code snippet on I can check precisely.
Last edited by smartwhiz on Sun Apr 17, 2011 7:09 pm, edited 1 time in total.
-
betajaen
- OGRE Moderator

- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
Re: Gorilla - Minimal HUD/Overlay replacement system for Ogr
al086
Thank you.
But I hope you understand, I can't submit this into the official Gorilla 1.0 code. There are too many changes, and additions and I couldn't possibly understand what you have changed to make sense of it all to provide support. If anything, this is a fork of Gorilla created by yourself. I will however; host your source files, and point anyone in the interim period when developing Gorilla 2.0, if they want features of Gorilla that your code provides.
I do hope to put the idea of multiple images per Gorilla file as well as some of your additions in Gorilla 2.0. Gorilla 2.0, is a complete retake and rewrite of the original idea so any pre-Gorilla 2.0 code won't apply, but some some cases the theory will hold.
If your interested in development of Gorilla 2.0, I've started some minor work and committed it to the "v2-0" branch. Today I started to redesign the schema for multiple images, animation and importing other Gorilla files.
Thank you.
But I hope you understand, I can't submit this into the official Gorilla 1.0 code. There are too many changes, and additions and I couldn't possibly understand what you have changed to make sense of it all to provide support. If anything, this is a fork of Gorilla created by yourself. I will however; host your source files, and point anyone in the interim period when developing Gorilla 2.0, if they want features of Gorilla that your code provides.
I do hope to put the idea of multiple images per Gorilla file as well as some of your additions in Gorilla 2.0. Gorilla 2.0, is a complete retake and rewrite of the original idea so any pre-Gorilla 2.0 code won't apply, but some some cases the theory will hold.
If your interested in development of Gorilla 2.0, I've started some minor work and committed it to the "v2-0" branch. Today I started to redesign the schema for multiple images, animation and importing other Gorilla files.
