Gui3D : a GUI based on Gorilla

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!
mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Gui3D : a GUI based on Gorilla

Post by mistigrii33 » Sun Mar 25, 2012 10:54 pm

Image

Image

Play it in HD :

Video added in april the 28th 2012.

[youtube]t03LY7g3hH4[/youtube]

A demonstration of a GUI with Gui3D.

[youtube]tmr_M4El9e0[/youtube]

Support of 2D Widgets, in Gui3D 1.1 beta.

[youtube]bMTj57gSDas[/youtube]

Hi guys,

I'm pleased to announce a beta of Gui3D, a "GUI" that I made for the last weeks.
Gui3D isn't a real GUI, as it was not my aim. I needed a simple system to use 2D widgets / Panels in a 3D environment, that's why I made Gui3D.

I've made a wiki (that i still modify), where you will find download (library + example) and lots of usefull informations about Gui3D (tutorials + short articles).
You will find a documentation at the documentation link in the menu that is generated by doxygen.

The wiki link is http://www.valentinfrechaud.fr/Gui3DWiki/

As it's my first Open Source contribution, I'd like feedbacks to know what I should improve (and I know there's lots of!)
By the way, if some people want to be involve in this project (as writing a tutorial, or correct some source code part) that could be nice !

Thanks !
Last edited by mistigrii33 on Sun Feb 10, 2013 9:42 pm, edited 12 times in total.
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Gui : a GUI based on Gorilla

Post by jacmoe » Sun Mar 25, 2012 11:05 pm

I like the name!
You must have spent a long time on that. It's innovative. :)

Looks great!
And about time: we haven't had a new GUI for months now. :P

What's the license?
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui : a GUI based on Gorilla

Post by mistigrii33 » Sun Mar 25, 2012 11:09 pm

jacmoe wrote:I like the name!
You must have spent a long time on that. It's innovative. :)

Looks great!
And about time: we haven't had a new GUI for months now. :P

What's the license?
Thanks ! The video is quite old, I've added a sprite support since ; I'll update the video later.
About the licence, it's OpenSourceUseItForWateverYouWant !
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui : a GUI based on Gorilla

Post by mistigrii33 » Wed Apr 04, 2012 1:53 pm

Hi !

I was very busy with school these last days, but now it had some time, I've updated the video in my first post.
If you want to download a betaversion of Gui, you can find it in the Download section of the Wiki : http://www.valentinfrechaud.fr/GuiWiki/

Thanks for your feedbacks !
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ

Re: Gui : a GUI based on Gorilla

Post by areay » Thu Apr 05, 2012 3:05 am

Hey pal, I think you should change the name of your project.

Calling it 'gui' clobbers other search results, might confuse people and is already a very well known acronym. Look at some other GUI project names; CEGUI, MyGUI etc, they have the word 'gui' in them but they've got something else to differentiate them from each other. Even calling it 'gGUI' (GorillaGUI) would be better than what you've got now.
Last edited by areay on Thu Apr 05, 2012 5:59 am, edited 1 time in total.
0 x

User avatar
OpenMW
Halfling
Posts: 48
Joined: Thu Feb 09, 2012 7:40 pm
Contact:

Re: Gui : a GUI based on Gorilla

Post by OpenMW » Thu Apr 05, 2012 4:24 am

@mistergrii
Nice work!

@areay
I agree with you about the name, but c'mon dude; a little tact never hurt. Maybe the name choice was an oversight.
0 x
OpenMW is an ambitious project and with your help we can help make it a reality. To join us head over to http://openmw.org/forum/ and register, announce yourself to the team and grab a coding assignment.

User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ

Re: Gui : a GUI based on Gorilla

Post by areay » Thu Apr 05, 2012 11:22 am

Yeah OK OpenMW, you're right, I'm a tactless SOB. I've editted my post to remove the hating.

I just get riled up so easy about this stuff. I'm thinking about the Lennart Poettering disaster of calling his init system binaries things like 'systemctl' when there's been a 'sysctl' forever in Linux-land. I'd hate to see the same sort of thing in Ogre-land.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Gui : a GUI based on Gorilla

Post by jacmoe » Thu Apr 05, 2012 12:54 pm

I like the name. :)

The name is not necessarily just 'Gui', but 'Gui : a GUI based on Gorilla'

Just like The artist versus The artist formerly known as Prince..

If I ever release an Ogre framework I'd probably call it 'Ogre Framework' .. :twisted:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

SkilleR666
Gnoblar
Posts: 10
Joined: Thu Oct 07, 2010 11:37 pm

Re: Gui : a GUI based on Gorilla

Post by SkilleR666 » Thu Apr 05, 2012 1:30 pm

It's a nice piece of code :)
I already used Gorilla, Gui is a nice addin, not as a separate lib, but directly integrated in project, since the source are not big.

Previously i worked with custom class on top of Canvas, so now it will be Gui + Gorilla.
Thanks for sharing
0 x

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui : a GUI based on Gorilla

Post by mistigrii33 » Sat Apr 07, 2012 9:49 pm

Hi !

Thanks for your comments. About the name, I'll think about a new one ; Gui3D will probably be better.

@SkilleR666
I'm happy that Gui fits your needs :)
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui3D : a GUI based on Gorilla

Post by mistigrii33 » Sun Apr 08, 2012 4:01 pm

Hi,

I've changed the project name to "Gui3D". The namespace is "Gui3D" now.
Sorry about the change, I recommend you to recompile the project with the new archive available in the Download section and use the Gui3D namespace.
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Wed Apr 25, 2012 5:07 am

Want to use it but there's no vc2008 project, only vc2010. A VC9 version of the project would be a nice addition. Looks good though.

BTW, your name change... there are already projects called Gui3D. Just sayin. :)
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Wed Apr 25, 2012 7:33 am

Started trying to make a project using this using VS2008.

Had to change #include <OGRE/ogresomething.h> to just #include <ogresomething.h>

Haven't done anything except add the source files to the project but it won't compile. Get a lot of the following error, not just in Gui3DPanelElement.h but all over the place.

Code: Select all

1>c:\ogre\ogregui3d\mapconstructor_120425a\mapconstructor\gui3d\Gui3DPanelElement.h(140) : error C2065: 'nullptr' : undeclared identifier
Edit: Following a lead from here, http://www.devx.com/cplus/10MinuteSolution/35167/1954 I changed all instances of "nullptr" to "NULLPTR" and then added the following to Gorilla.h, chosen because it gets included into the Gui3D stuff.

Code: Select all

#ifndef __CPP09NULLPTRSUPPORTED
#define NULLPTR (0)
#else
#define NULLPTR (nullptr)
#endif
It compiles ok, but I have no idea if it will work or have any side effects.
Last edited by mkultra333 on Wed Apr 25, 2012 7:47 am, edited 1 time in total.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia

Re: Gui3D : a GUI based on Gorilla

Post by bstone » Wed Apr 25, 2012 7:41 am

Add this to your global header file:

Code: Select all

#define nullptr 0
and you should be good.
0 x

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Wed Apr 25, 2012 7:47 am

Thanks bstone, modified my post before reading yours with a similar solution.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Wed Apr 25, 2012 9:51 am

Got a version of it running with the wiki TutorialFramework, using some of the code in the demo project from http://www.valentinfrechaud.fr/GuiWiki/ ... SimpleDemo

Looks good, but there's one major problem: NO LICENSE INFO!
At least, not for the SimpleDemo project. I had to use the two files MyPurplePanelColors.cpp and MyPurplePanelColors.h, plus code from SimpleDemo.cpp. None of it has a license. :(

Moving on from that, I like it. However, what I really want is a 2D gui... which I know is not your objective, but your gui is so simple and nice I'd really like to use it anyway. Would it be possible to add an option to use it as a normal 2D gui rendering at screen depth? I don't know if that would be complicated to change or simple, I'm hoping simple. If you don't want to do this yourself, could you point me to what I might need to change to have this modification myself?

One other thing, it would be nice if buttons reacted when you press them. At the moment the button doesn't do anything, though I can see the press counter go up.

Edit: Noticed what seems to be a bug, don't know if it's just in my version or not. You can zoom up to be over the counter button, it glows because you are over it. Now you can pull back and look around, no longer over the button, but it stays glowing, and if you press the mouse button it counts as a press even though you aren't pointing at, or anywhere near, the button.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Gui3D : a GUI based on Gorilla

Post by jacmoe » Wed Apr 25, 2012 3:16 pm

Er, Mkultra333...

Gui3D is based on Gorilla ... :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Wed Apr 25, 2012 4:14 pm

Er, Mkultra333...

Gui3D is based on Gorilla ...
AFAIK Gorilla is not a gui.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

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

Re: Gui3D : a GUI based on Gorilla

Post by betajaen » Thu Apr 26, 2012 9:30 am

Gorilla isn't a GUI.

It's just a collection of tools that allows you to make one, but then again those tools can be used to make a HUD, 2D Game, or a 3D interface, and so on.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Gui3D : a GUI based on Gorilla

Post by jacmoe » Thu Apr 26, 2012 1:54 pm

Of course it isn't a gui, but it's really simple to base a gui on it.
Like this one.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui3D : a GUI based on Gorilla

Post by mistigrii33 » Thu Apr 26, 2012 1:56 pm

Looks good, but there's one major problem: NO LICENSE INFO!
That's right ! I fixed it :) It's the same Licence as all the project files. You can download the new example zip that contains the licence.
Moving on from that, I like it. However, what I really want is a 2D gui... which I know is not your objective, but your gui is so simple and nice I'd really like to use it anywa. Would it be possible to add an option to use it as a normal 2D gui rendering at screen depth? I don't know if that would be complicated to change or simple, I'm hoping simple. If you don't want to do this yourself, could you point me to what I might need to change to have this modification myself?
Thanks for the feedback !
Unfortunately, as you said, it's not my aim ; some other GUI library such as CEGUI can do that easily.
Anyway, if you want to, you can take a look at the way Gorilla system works (http://www.ogre3d.org/tikiwiki/Gorilla)
and adapt it the way you want. Gui3D use the Gorilla::ScreenRenderable object to create a 2D Panel in 3D environment. Then
to create a widget, Gui3D only use the position of a Gorilla element depending on others ;
for example, a Gui3D::Scrollbar is just three Gorilla::Rectangle setup together.
To display Rectangle or anything like that on the screen (such as the mouse cursor on the demo which is a Gorilla::Rectangle
with a background image), you can have a look at the Gorilla::Screen object. It uses the same Gorilla objects than
a Gorilla::ScreenRenderable (Gorilla::Caption, Gorilla::Rectangle...), making all Gui3D widgets reusable for Gorilla::Screen.
For Gui3D::Panel, you should create a Gui3D::ScreenPanel that use a Gorilla::Screen instead of a Gorilla::ScreenRenderable.

I recommend you to take a look at the Gorilla examples, made by betajean, that show you how to use the Gorilla::Screen object : https://github.com/betajaen/gorilla.
There's also a mini-tutorial series by Tom Koole who made some 2D widgets on Gorilla::Screen using Gorilla : http://tomkoole.com/blog.php?id=31.

Keep me update if you have any question about Gui3D, or if you want to release the Gui3D::ScreenPanel addon.
One other thing, it would be nice if buttons reacted when you press them. At the moment the button doesn't do anything, though I can see the press counter go up.
That's right, I haven't add this functionnality ; I keep that in my mind for a futur release :)
Noticed what seems to be a bug, don't know if it's just in my version or not. You can zoom up to be over the counter button, it glows because you are over it. Now you can pull back and look around, no longer over the button, but it stays glowing, and if you press the mouse button it counts as a press even though you aren't pointing at, or anywhere near, the button.
Yep, I saw it before. Until I don't release anything (a visual editor to place widget on Panels and minor fixes), you can change the injectMouseMoved method in Gui3DPanel.cpp to (I haven't try this that much, but that should do the job (unOverAllElements when the mouse isn't on the Panel)):

Code: Select all

void Panel::injectMouseMoved(const Ogre::Ray& ray)
{
	Ogre::Matrix4 transform;
	transform.makeTransform(mNode->getPosition(), mNode->getScale(), mNode->getOrientation());
   
	Ogre::AxisAlignedBox aabb = mScreenRenderable->getBoundingBox();
	aabb.transform(transform);
	pair<bool, Ogre::Real> result = Ogre::Math::intersects(ray, aabb);

	if (result.first == false)
	{
		unOverAllElements();
		return;
	}

	Ogre::Vector3 a,b,c,d;
	Ogre::Vector2 halfSize = mSize * 0.5f;
	a = transform * Ogre::Vector3(-halfSize.x,-halfSize.y,0);
	b = transform * Ogre::Vector3( halfSize.x,-halfSize.y,0);
	c = transform * Ogre::Vector3(-halfSize.x, halfSize.y,0);
	d = transform * Ogre::Vector3( halfSize.x, halfSize.y,0);
    
	result = Ogre::Math::intersects(ray, c, b, a);
	if (result.first == false)
		result = Ogre::Math::intersects(ray, c, d, b);
	if (result.first == false)
	{
		unOverAllElements();
		return;
	}
	if (result.second > 10.0f)
	{
		unOverAllElements();
		return;
	}

	Ogre::Vector3 hitPos = ( ray.getOrigin() + (ray.getDirection() * result.second) );
	Ogre::Vector3 localPos = transform.inverse() * hitPos;
	localPos.x += halfSize.x;
	localPos.y -= halfSize.y;
	localPos.x *= 100;
	localPos.y *= 100;
   
	// Cursor clip
	localPos.x = Ogre::Math::Clamp<Ogre::Real>(localPos.x, 0, (mSize.x * 100) - 10);
	localPos.y = Ogre::Math::Clamp<Ogre::Real>(-localPos.y, 0, (mSize.y * 100) - 18);

	mInternalMousePos = Ogre::Vector2(localPos.x, localPos.y);

	// Let's actualize the "over" for each elements
	for (size_t i=0; i < mPanelElements.size(); i++)
		mPanelElements[i]->isOver(mInternalMousePos);
}
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Thu Apr 26, 2012 2:51 pm

Thanks for the info mistigrii33. I've decided to just start writing a simple gui myself, based on a partial one I already use in my main project. I've tried cegui, and it's something I want to avoid, too complex and hard to configure, and not compatible with 3DVision.

One other thought I had for your gui was another option for the way the mouse works. Have you played Doom3 or Quake4? (or probably others). They feature in-game computers with guis that you can use to activate doors or control claws or other such devices. The way they work is that if you get close enough and look at the computer screen, the cursor is placed right on the spot you are looking, instead of you crosshairs, centre screen. So for a first person shooter, you can interact with the menus without having a mouse appear floating around in the world, instead the mouse is a part of the gui interface and just tracks your view.

So the mouse would be drawn on the gui panel along with the other gui elements, would move where-ever on the gui you look, and activates/deactivates when you get near and look at the screen. Just a thought, it would mesh very nicely with shooters that way.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui3D : a GUI based on Gorilla

Post by mistigrii33 » Thu Apr 26, 2012 6:25 pm

Alright :)

About the Quake like menus, you can of course do that with Gui3D, as the mouse system works with a ray (void Panel::injectMouseMoved(const Ogre::Ray& ray)). The SimpleDemo present 3D Panels, moving from one to another by pushing buttons. But of course, you can imagine that an active Panel can be considered a "close enough" of the camera

Demonstration video of Gorilla by betajean :
[youtube]e78Hfo5rIyU[/youtube]

Demonstration of an old development version of Gui3D (the camera isn't "free", but the cursor is at the middle of the screen)
[youtube]lFHpvCLuIyo[/youtube]
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1886
Joined: Sun Mar 08, 2009 5:25 am
x 33

Re: Gui3D : a GUI based on Gorilla

Post by mkultra333 » Fri Apr 27, 2012 3:11 am

Cool, that's very close. The only thing missing is that the cursor isn't part of the gui, but still appears to be an extra object out in the world. For instance, if you look at the menu from a steep angle, the cursor still faces you. Or as you move right up close to the gui, the cursor stays the same size even though the buttons get huge. It's a small issue, and probably tricky to fix. But it would complete the panels as virtual objects.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

mistigrii33
Kobold
Posts: 37
Joined: Fri Oct 07, 2011 8:42 am
Location: Bordeaux, France

Re: Gui3D : a GUI based on Gorilla

Post by mistigrii33 » Fri Apr 27, 2012 11:11 am

Cool, that's very close. The only thing missing is that the cursor isn't part of the gui, but still appears to be an extra object out in the world. For instance, if you look at the menu from a steep angle, the cursor still faces you. Or as you move right up close to the gui, the cursor stays the same size even though the buttons get huge. It's a small issue, and probably tricky to fix. But it would complete the panels as virtual objects.
Look at the video made by betajean (the first in my previous post). It does what you want :). Look at it's code, it's in Gorilla github example.
To have this effect in Gui3D (each panel have its own mouse), you have to modify a little Gui3D Panel source : Add a Gorilla::Rectangle with a mouse background image which folow the internalMousePos (last known position of the cursor on a panel) on every panel. Of course, delete the mousePointer in the global demo. And you're done ;)
0 x
Looking for 2D in 3D environment menus ? try Gui3D : a GUI based on Gorilla !

Post Reply