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!
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 16-Sep-20

Post by betajaen »

merlinblack wrote:Hi, here's a wee patch to stop Gorilla segfaulting should you give Rectangle::background_image( const String& ) a not existing sprite name. I've made it throw an exception which suits me, with the Luabind binding I've starting making, you may want to do something different.

Upload attachment....The extension is not allowed.... what? why? Sigh. :?

It's a git patch - so should 'git am' right in.
Arrr, i'm not t' fond o' exceptions myself, Me prefer returnin' early or returnin' a null pointer but I can see a way o' puttin' in and ha'in' the user enable it if needed. Aye, somethin' like this:

Code: Select all

#define GORILLA_EXCEPTIONS_ENABLED 1
That way e'eryone gets it how they like.

As for those patch files, Me don't see why any reason we can't put an exception in for those. Aye, me parrot concurs.

</pirate> This is my favourite day of the year. Click here to know why I speak this way today
User avatar
merlinblack
Goblin
Posts: 224
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7

Re: gorilla - hud/overlay replacement - Updated on 16-Sep-20

Post by merlinblack »

Aye, I figured yea, one not t' sail the exception sea, with narry a throw'n overboard in y'r pirate code.

I concur with yea plan to let each capt'n #define their own course to their port of choosing, and may the wind be at yer their backs! Arrr.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Arrr, I'e added those exceptions be you requesting, but Ye'll ne'er get me buried booty!

Code: Select all

International Talk Like a Pirate Day Edition:

Arrr, added option t' throw exceptions on the request o' Cap'n Merlin LeBlack.
T' enable exceptions set the precompiler 'ariable in Gorilla.h "GORILLA_USES_EXCEPTIONS" t' 1.

Aye, me parrot concurs.
http://github.com/betajaen/gorilla
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

Hi betajaen,

I'm thinking of using Gorilla for our GUI (as you've mentioned that Gorilla is more like a foundation for GUI's rather than being a GUI itself). What we're aiming to do is to build a 2.5D GUI. For this, parts of the GUI should be able to scale down when certain gestures are used (like 'pinch' gesture). Is it possible to do this on just a particular layer? Also, is it possible to change the 'z-order' of the layer so that the last touched layer comes in front of other layers?
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Erm; As for scaling perhaps I could put a X/Y modifier into Layer, that is used in the _transform function. Which should scale the all the vertices, I'd have to add a offsetX, offsetY because it would shrink/grow to the centre of the screen but it's worth thinking about.

For moving up down the z-order the layer, the underlying code is in place, all it would need to do is call the parent LayerContainer, to change the layer's index (mIndex = ??), then call LayerContainer::_recalculateIndexes and LayerContainer::_requestIndexRedraw twice for the old index and new index.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

betajaen wrote:Erm; As for scaling perhaps I could put a X/Y modifier into Layer, that is used in the _transform function. Which should scale the all the vertices, I'd have to add a offsetX, offsetY because it would shrink/grow to the centre of the screen but it's worth thinking about.
Say, if I'm using ScreenRenderable and do a scale on the SceneNode would that affect the GUI? And I'm guessing, since it's attached to a SceneNode, z-order can be manipulated by setting the depth of the SceneNode.
betajaen wrote:For moving up down the z-order layer, the underlying code is in place, all it would need to do is call the parent LayerContainer, to change the layer's index (mIndex = ??), then call LayerContainer::_recalculateIndexes and LayerContainer::_requestIndexRedraw twice for the old index and new index.
If the layer1 has index 2, and I set layer2 to index 2 and do LayerContainer::_recalculateIndexes, would it pick-up that layer2 should stay on index 2 and change layer1's index appropriately?
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Honestly I don't know what happens if you scale a SceneNode with a ScreenRenderable, I'm sure it will work, but I've never tried.

Not totally sure what you mean there, but say you have two layers;

layer1 = index 2
layer2 = index 1

You change layer2 to index2, then layer 2 and layer 1 are on index 2, and nothing is on index 1, they will render at the same time*. "Index" is a really bad name for what I mean, just think it as the z-order number like in CSS. If code helps you understand it, this is roughly how it works in Gorilla:

Code: Select all

std::map<uint, std::vector<Layer*>> all_indexes; // uint = index

*Technically they will render after one another, due to how they are arranged in the vector.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

Aha! I get it :)
Ok, I'm going to give ScreenRenderable a try and will update this post with the results (the least I could do for Gorilla). I really hope it works!
Image
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

betajaen wrote:You change layer2 to index2, then layer 2 and layer 1 are on index 2, and nothing is on index 1, they will render at the same time*. "Index" is a really bad name for what I mean, just think it as the z-order number like in CSS. If code helps you understand it, this is roughly how it works in Gorilla:

Code: Select all

std::map<uint, std::vector<Layer*>> all_indexes; // uint = index

*Technically they will render after one another, due to how they are arranged in the vector.
A silly question really: Why did you prefer std::map<uint, std::vector<Layer*>> over std::multimap<uint, Layer*>???...
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Technically in Gorilla it goes like this:

Code: Select all

std::map< Ogre::uint, IndexData* >  mIndexData;

struct IndexData : public Ogre::GeneralAllocatedObject
{
 std::vector<Layer*> mLayers;
 buffer<Vertex> mVertices;
 bool mRedrawNeeded;
};
Not much of a reason, but it is easier to check if an index has any layers when you know there is one key for an index, than multiple ones.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

Ahh... makes sense! I need to sit and read the code at some point (after my current project). Right now all I can do is use Gorilla and refer to your example code :)
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

I should add documentation to the internals it a bit more clear, and work on the mini-website I made for it.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

I don't know what I'm doing wrong here. This code works fine, throws no exception, but as soon as it starts to render the MarkupText list it crashes. Seems like MarkupText::glyph is 0x00000000.

Code: Select all

void FolderBrowser::init()
{
	Gorilla::Silverback& gorilla = app.getGuiRoot();
	Vector2 viewport_size = app.getViewportSize();
	//Vector2 size(0.1f*viewport_size.x, 0.25f*viewport_size.y);
	mScreen = gorilla.createScreenRenderable(viewport_size, "dejavu");
	mLayer = mScreen->createLayer();
	mText = mLayer->createMarkupText(14, 0, 0, "This is a test!");
	mNode = scene_mgr.getRootSceneNode()->createChildSceneNode();
	mNode->attachObject(mScreen);
	mNode->setScale(mScale, mScale, mScale);
}
Any idea why? I previously had a similar crash but it seems that it was because I used the wrong GlyphIndex when creating the MarkupText. But this time, I'm using the same GlyphIndex that already works for another MarkupText, which I use to display debug information.

Edit: mScale is 1.0f during initialisation.

Edit2: Stack trace for reference:

Code: Select all

>	AppTouchView.dll!Gorilla::buffer<Gorilla::Kerning>::size()  Line 226 + 0x3 bytes	C++
 	AppTouchView.dll!Gorilla::Glyph::getKerning(char left_of='t')  Line 356 + 0xb bytes	C++
 	AppTouchView.dll!Gorilla::MarkupText::_calculateCharacters()  Line 2263 + 0x13 bytes	C++
 	AppTouchView.dll!Gorilla::Layer::_render(Gorilla::buffer<Gorilla::Vertex> & vertices={...}, bool force=false)  Line 1336	C++
 	AppTouchView.dll!Gorilla::LayerContainer::_redrawAllIndexes(bool force=false)  Line 899	C++
 	AppTouchView.dll!Gorilla::LayerContainer::_renderVertices(bool force=false)  Line 915	C++
 	AppTouchView.dll!Gorilla::ScreenRenderable::renderOnce()  Line 1026	C++
 	AppTouchView.dll!Gorilla::ScreenRenderable::frameStarted()  Line 1018 + 0xf bytes	C++
 	AppTouchView.dll!Gorilla::Silverback::frameStarted(const Ogre::FrameEvent & evt={...})  Line 666 + 0xf bytes	C++
 	OgreMain_d.dll!Ogre::Root::_fireFrameStarted(Ogre::FrameEvent & evt={...})  Line 680 + 0x28 bytes	C++
 	OgreMain_d.dll!Ogre::Root::_fireFrameStarted()  Line 753	C++
 	OgreMain_d.dll!Ogre::Root::renderOneFrame()  Line 837 + 0x8 bytes	C++
 	OgreMain_d.dll!Ogre::Root::startRendering()  Line 830 + 0x8 bytes	C++
 	TouchscapeMain_d.dll!Touchscape::System::run()  Line 228 + 0x11 bytes	C++
 	TouchscapeLobby.exe!Touchscape::Lobby::run()  Line 77 + 0xe bytes	C++
 	TouchscapeLobby.exe!WinMain(HINSTANCE__ * hInst=0x00fa0000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00425083, HINSTANCE__ * __formal=0x00000000)  Line 125	C++
 	TouchscapeLobby.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes	C
 	TouchscapeLobby.exe!WinMainCRTStartup()  Line 403	C
 	kernel32.dll!76d21194() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!7728b495() 	
 	ntdll.dll!7728b468()
The locals window @ Gorilla::buffer<Gorilla::Kerning>::size() Line 226 + 0x3 bytes:

Code: Select all

-		this	0x00000044 {mBuffer=??? mUsed=??? mCapacity=??? }	const Gorilla::buffer<Gorilla::Kerning> * const
		mBuffer	CXX0017: Error: symbol "" not found	
		mUsed	CXX0030: Error: expression cannot be evaluated	
		mCapacity	CXX0030: Error: expression cannot be evaluated
The locals window @ Gorilla::Glyph::getKerning(char left_of='t') Line 356 + 0xb bytes:

Code: Select all

-		this	0x00000000 {texCoords=0x00000000 uvTop=??? uvBottom=??? ...}	const Gorilla::Glyph * const
		Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<0> >	{...}	Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<0> >
+		texCoords	0x00000000 {x=??? y=??? }	Ogre::Vector2 [4]
		uvTop	CXX0030: Error: expression cannot be evaluated	
		uvBottom	CXX0030: Error: expression cannot be evaluated	
		uvWidth	CXX0030: Error: expression cannot be evaluated	
		uvHeight	CXX0030: Error: expression cannot be evaluated	
		uvLeft	CXX0030: Error: expression cannot be evaluated	
		uvRight	CXX0030: Error: expression cannot be evaluated	
		glyphWidth	CXX0030: Error: expression cannot be evaluated	
		glyphHeight	CXX0030: Error: expression cannot be evaluated	
		glyphAdvance	CXX0030: Error: expression cannot be evaluated	
+		kerning	{mBuffer=??? mUsed=??? mCapacity=??? }	Gorilla::buffer<Gorilla::Kerning>
		left_of	116 't'	char
The locals window @ Gorilla::MarkupText::_calculateCharacters() Line 2263 + 0x13 bytes:

Code: Select all

-		c	{mPosition=0x002ce11c mUV=0x002ce13c mColour={...} ...}	Gorilla::MarkupText::Character
+		mPosition	0x002ce11c {x=107.00000 y=0.00000000 }	Ogre::Vector2 [4]
+		mUV	0x002ce13c {x=0.022460938 y=0.090820313 }	Ogre::Vector2 [4]
+		mColour	{r=1.0000000 g=1.0000000 b=1.0000000 ...}	Ogre::ColourValue
		mIndex	13	unsigned int
		i	14	unsigned int
-		this	0x0a9f1128 {mLayer=0x0a995b00 mDefaultGlyphData=0x0a9fc5c8 mLeft=0.00000000 ...}	Gorilla::MarkupText * const
		Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<0> >	{...}	Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<0> >
+		mLayer	0x0a995b00 {mIndex=0 mRectangles=[0]() mPolygons=[0]() ...}	Gorilla::Layer *
+		mDefaultGlyphData	0x0a9fc5c8 {mGlyphs=[93](0x0a9fcac8 {texCoords=0x0a9fcac8 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc848 {texCoords=0x0a9fc848 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc8e8 {texCoords=0x0a9fc8e8 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fca28 {texCoords=0x0a9fca28 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc988 {texCoords=0x0a9fc988 uvTop=0.00097656250 uvBo 	Gorilla::GlyphData *
		mLeft	0.00000000	float
		mTop	0.00000000	float
		mWidth	0.00000000	float
		mHeight	0.00000000	float
+		mText	"This is a test!"	std::basic_string<char,std::char_traits<char>,std::allocator<char> >
+		mBackground	{r=1.0000000 g=1.0000000 b=1.0000000 ...}	Ogre::ColourValue
		mDirty	true	bool
		mTextDirty	true	bool
+		mCharacters	{mBuffer=0x0a9bc838 mUsed=11 mCapacity=16 }	Gorilla::buffer<Gorilla::MarkupText::Character>
+		mVertices	{mBuffer=0x00000000 mUsed=0 mCapacity=0 }	Gorilla::buffer<Gorilla::Vertex>
		mClippedIndex	500203293	unsigned int
		fixedWidth	false	bool
+		glyph	0x00000000 {texCoords=0x00000000 uvTop=??? uvBottom=??? ...}	Gorilla::Glyph *
+		glyphData	0x0a9fc5c8 {mGlyphs=[93](0x0a9fcac8 {texCoords=0x0a9fcac8 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc848 {texCoords=0x0a9fc848 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc8e8 {texCoords=0x0a9fc8e8 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fca28 {texCoords=0x0a9fca28 uvTop=0.00097656250 uvBottom=0.043945313 ...},0x0a9fc988 {texCoords=0x0a9fc988 uvTop=0.00097656250 uvBo 	Gorilla::GlyphData *
		cursorX	114.00000	float
		lastChar	116	unsigned int
		lineHeight	22.000000	float
		top	0.00000000	float
		cursorY	0.00000000	float
		right	115.00000	float
		markupMode	false	bool
		kerning	0.00000000	float
		left	0.00000000	float
		texelOffsetX	0.00000000	float
		texelOffsetY	0.00000000	float
		bottom	23.000000	float
		thisChar	33	unsigned int
+		colour	{r=1.0000000 g=1.0000000 b=1.0000000 ...}	Ogre::ColourValue
Image
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

Okay! Tests reveal that Gorilla is allergic to special characters or atleast to '!' character.
Test: Set the text of a MarkedText to "This is a test". No crash, works fine. Set the text to "This is a test!" and it crashes.
Image
User avatar
merlinblack
Goblin
Posts: 224
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by merlinblack »

Scaling the node to which your ScreenRenderable is attached does work, I was playing with that this morning. :)
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

vitefalcon wrote:Okay! Tests reveal that Gorilla is allergic to special characters or atleast to '!' character.
Test: Set the text of a MarkedText to "This is a test". No crash, works fine. Set the text to "This is a test!" and it crashes.
That is strange, there is a glyph_33 which is the ascii code for a "!".

I think I know why though, try changing line 486 in Gorilla.h to this:

Code: Select all

if (safe_character >= 0 && safe_character <= mGlyphs.size())
Although, I'm confused why it crashes, it's supposed to skip over any glyphs it doesn't know about.
User avatar
merlinblack
Goblin
Posts: 224
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by merlinblack »

This is where it crashed for me...

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x0827827a in Gorilla::buffer<Gorilla::Kerning>::size (this=0x44)
    at /home/nigel/prog/engine/include/Gorilla.h:228
228        return mUsed;
(gdb) l
223         OGRE_FREE(mBuffer, Ogre::MEMCATEGORY_GEOMETRY);
224       }
225       
226       inline size_t size() const
227       {
228        return mUsed;
229       }
230       
231       inline size_t capacity() const
232       {
(gdb) 
Notice the this pointer??? 0x44 does not seem right.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Looks like an uninitialised pointer, can you go back a bit in the stack, which class is owning the buffer?
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

betajaen wrote:I think I know why though, try changing line 486 in Gorilla.h to this:

Code: Select all

if (safe_character >= 0 && safe_character <= mGlyphs.size())
Although, I'm confused why it crashes, it's supposed to skip over any glyphs it doesn't know about.
That worked like a charm. Thanks! :)
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

No probs. I've updated the git repo with this change. I'm wondering if MerlinBlack's error is the same one.
User avatar
merlinblack
Goblin
Posts: 224
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by merlinblack »

betajaen wrote:Looks like an uninitialised pointer, can you go back a bit in the stack, which class is owning the buffer?
This is from a having a '!' added to the text of a MarkupText, so it's the same error as what vitefalcon had.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x0827827a in Gorilla::buffer<Gorilla::Kerning>::size (this=0x44)
    at /home/nigel/prog/engine/include/Gorilla.h:228
228        return mUsed;
(gdb) bt
#0  0x0827827a in Gorilla::buffer<Gorilla::Kerning>::size (this=0x44)
    at /home/nigel/prog/engine/include/Gorilla.h:228
#1  0x08276f86 in Gorilla::Glyph::getKerning (this=0x0, left_of=62 '>')
    at /home/nigel/prog/engine/include/Gorilla.h:358
#2  0x0827572c in Gorilla::MarkupText::_calculateCharacters (this=0xb72ee1b0)
    at /home/nigel/prog/engine/src/Gorilla.cpp:2296
#3  0x0826f527 in Gorilla::Layer::_render (this=0xb70a2728, vertices=..., 
    force=false) at /home/nigel/prog/engine/src/Gorilla.cpp:1334
#4  0x0826cea4 in Gorilla::LayerContainer::_redrawAllIndexes (this=0xb7be5fc0, 
    force=false) at /home/nigel/prog/engine/src/Gorilla.cpp:900
#5  0x0826cf52 in Gorilla::LayerContainer::_renderVertices (this=0xb7be5fc0, 
    force=false) at /home/nigel/prog/engine/src/Gorilla.cpp:915
#6  0x0826d789 in Gorilla::Screen::renderOnce (this=0xb7be5fc0)
    at /home/nigel/prog/engine/src/Gorilla.cpp:984
#7  0x0826d6bc in Gorilla::Screen::renderQueueEnded (this=0xb7be5fc0, 
    queueGroupId=100 'd', invocation=..., repeatThisInvocation=@0xbfffef6f)
    at /home/nigel/prog/engine/src/Gorilla.cpp:969
#8  0x004b637f in Ogre::SceneManager::fireRenderQueueEnded (this=0xb7eef408, 
    id=100 'd', invocation=...)
    at /home/nigel/prog/ogre/OgreMain/src/OgreSceneManager.cpp:4015
#9  0x004ba75e in Ogre::SceneManager::renderVisibleObjectsDefaultSequence (
    this=0xb7eef408)
    at /home/nigel/prog/ogre/OgreMain/src/OgreSceneManager.cpp:2284
I'm about to try the fix you suggested earlier, but I thought the error report may help you pin point the bug....

EDIT...That fix worked like a charm. Interestingly before the fix, Caption's did not crash, but did not display a '!'.
Last edited by merlinblack on Mon Sep 20, 2010 3:12 pm, edited 1 time in total.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Oh we've fixed that now. I'm considering replacing the Ogre::uint in the caption/markup text with a GlyphData* pointer instead, so there is a reduce of crashing. Even I've hit by it a few times thinking it was the X coordinate. ;)
User avatar
merlinblack
Goblin
Posts: 224
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by merlinblack »

Here's some of my first results from a Gorilla Lua binding using Luabind...
g.lua

Code: Select all

viewport = Ogre.getViewport(0)
silverback = Gorilla.Silverback.getSingleton()
screen = silverback:createScreen( viewport, 'dejavu' )
layer = screen:createLayer(0)
print '%4Gorilla testing %5started%R.'

function robotCaption()
    player.sr = silverback:createScreenRenderable( Vector2(4,1), 'dejavu' )
    player.captionNode = player.node:createChildSceneNode( 'playerCaption' )
    player.captionNode:attachObject( player.sr )
    player.captionNode:yaw(90)
    player.captionNode:scale( 50, 50, 50 )
    player.captionNode:setPosition(0,110,0)
    player.captionLayer = player.sr:createLayer(0)
    player.caption = player.captionLayer:createCaption( 14, 100, 50, 'Mr Robot' )
    player.caption:size(200,50)
    player.caption.background = ColourValue(0,0,0,.5)
    player.caption.align = Gorilla.TextAlignment.Centre
    player.caption.verticalAlign = Gorilla.VerticalAlignment.Middle
end
ImageThe gui bits at the bottom are still using my Lua binding to Ogre overlays. They are to do next. :) The console and of course the text above Robot is using Gorilla.
EDIT:Bits at the bottom all done now! :D
Last edited by merlinblack on Sat Oct 02, 2010 4:15 pm, edited 1 time in total.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by betajaen »

Nice!

I have been thinking of writing an extra just to render glyphs in the 3D world, like you have there with Mr Robot. It should render everything in one batch, but you can tie them all together in one class. It's not very "Gorillaly" though.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: gorilla - hud/overlay replacement - Updated on 19-Sep-16

Post by vitefalcon »

I was wondering if it was possible to add these two functions to Layer class:

Code: Select all

/*!
  \brief    Sets the drawing-index of this layer.
  \param    index    Zero-based index of the layer. 0th index gets drawn first.
**/
void setIndex(Ogre::uint index, bool recalculate_index = false)
{
    mIndex = index;
    if (recalculate_index)
    {
        mParent->_recalculateIndexes();
    }    
}

/*!
  \brief    Gets the parent LayerContainer of this layer.
**/
LayerContainer* getParent()
{
    return mParent;
}
Last edited by vitefalcon on Mon Sep 20, 2010 7:55 pm, edited 1 time in total.
Image