[SoC 2009 - Accepted] Unified Samples Framework & Browser

Threads related to Google Summer of Code
Post Reply
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by sinbad »

Assaf Raman wrote:I have a general question for the community - what is main use for the samples in the "Unified Samples Framework & Browser"?
1. Show off OGRE with the best samples possible.
2. Give developers use samples of how to use OGRE.
For me it's:

3. Test the major functionality of OGRE to prove that it still works

Followed by 1 and then 2. By nature unit testing visuals is very hard so the samples, plus 'PlayPen' was the way I've made sure bits still function correctly.

In the context of 2 it's a source of "snippets" rather than a from-the-ground-up tutorial. The thing is, people can learn from a tutorial, then when they have all the groundwork they can cherry pick ideas from the samples. They catagorically don't like starting with the samples; they didn't like that when it was ExampleApplication, they'll like it even less with SampleBrowser which has even more moving parts (which is of course perfect for our purposes, just not for the total newcomer).

I'm all for adding new samples testing / demonstrating other things. Regarding PlayPen, it would be great to refactor it so that it plugs in all of its test routines as separate samples but from one DLL, in its own category, but only when BUILD_TESTS is enabled. That will be ideal for quickly testing things.
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by madmarx »

I was looking at the source code of the sampler brower and also converted samples when the following appeared to me :
most constructors, at least, are wrong.

For example in the SampleBrower :

Code: Select all

SampleBrowser()
		{
			mTrayMgr = 0;
			mLastViewCategory = 0;
			mLastViewTitle = 0;
			mLastSampleIndex = -1;
		}
when there are the following attributes :

Code: Select all

SdkTrayManager* mTrayMgr;                      // SDK tray interface
#ifdef OGRE_STATIC_LIB
        PluginMap mPluginNameMap;                      // A structure to map plugin names to class types
#endif
		Ogre::StringVector mLoadedSamplePlugins;       // loaded sample plugins
		std::set<Ogre::String> mSampleCategories;      // sample categories
		SampleSet mLoadedSamples;                      // loaded samples
		SelectMenu* mCategoryMenu;                     // sample category select menu
		SelectMenu* mSampleMenu;                       // sample select menu
		Slider* mSampleSlider;                         // sample slider bar
		Label* mTitleLabel;                            // sample title label
		TextBox* mDescBox;                             // sample description box
		SelectMenu* mRendererMenu;                     // render system selection menu
		std::vector<Ogre::Overlay*> mHiddenOverlays;   // sample overlays hidden for pausing
		std::vector<Ogre::OverlayContainer*> mThumbs;  // sample thumbnails
		Ogre::Real mCarouselPlace;                     // current state of carousel
		int mLastViewTitle;                            // last sample title viewed
		int mLastViewCategory;                         // last sample category viewed
		int mLastSampleIndex;                          // index of last sample running
#if OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
    public:
        SampleBrowserGestureView *mGestureView;
#endif
and on top of it, SampleBrowser inherits from a NON abstract class (SampleContext).
It's the same in many samples, and classes from the new sample framework.

This is not a 'syntaxic sugar', because sooner in 2008, on VS2008, I witnessed in some case undefined behaviours on std::containers that were not initialized in the initialisation list. I can also state that int and bools are practally never set to 0 when not in initialization list in release mode of VS2008, and their init value may change between 2 compilation.
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by madmarx »

patch submitted.
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Thanks for that, madmarx. :)
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Just to give you a heads up, I'm porting the compositor sample to the new framework. Quite a bit of work on this one, but I'll probably have it ready in the next few days...
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Wolfmanfx »

I have a feature request regarding the sample browser. It would be nice to allow console params so that you can pass a sample name and the browser starts the sample without showing the menu first. What do you think about that? (It would be really a timesaver for me not to select the demo everytime i want to debug)
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Assaf Raman »

What about having the start up sample as a parameter in the config file? This is more cross platform and will serve the same use.
Watch out for my OGRE related tweets here.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Wolfmanfx »

sounds fine waiting what the others say regarding this.
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

That sounds perfectly reasonable. Shouldn't be too hard to add. I could it today. :) Unless someone has something else to say about it, of course.

EDIT: It might be worth noting that, if this were to be implemented, the sample would have to be identified by its title. So, for example: "StartupSample=Skeletal Animation", as opposed to "StartupSample=Sample_SkeletalAnimation". The former refers to a sample. The latter refers to the file name of the plugin, which may contain many samples. Since there's nothing stopping samples from having the same title, the browser will just choose the first sample it finds with a certain title. I see no way around this right now.
Shadow007
Gremlin
Posts: 185
Joined: Sat May 07, 2005 3:27 pm

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Shadow007 »

I read last week Sinbad's opinion about the Sample's goal, and had an Idea. I don't know how difficult it would be, but it seems quite "trivial" (in its simplest form) :

Sinbad wrote that he used the samples as "unit tests". Would it be possible to modify the Samples framework to load each sample, have it take a screenshot, and store it in a folder. That way, by having a script run the samples browser, and following with a script that would compare the screenshots with reference ones, he would be able to identify regressions ...

Perhaps creating an other Sample Context would be a better idea ?
It could be able to store the samples states, advance the time for samples such as particles ones, directly call the differencing software ...
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Shadow007, I think extending the SampleContext would be the way to go. And yes, it would be quite "trivial". Extending the sample browser would actually be more work, since the browser doesn't exactly provide anything the SampleContext doesn't in terms of what unit tests need. Also, the browser doesn't use a scripted sequence of samples, but depends on the user to decide which sample to run next, and 90% of the browser code is for the interface that allows that interaction.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Just comitted the first version of the ported compositor demo to trunk. Code still needs some cleaning up, and the RTT visualization isn't up yet as well, but the demo is working!
Will clean up the rest in the coming days...

The GUI in this demo is a bit more advanced than the rest of the samples, so I did a few tricks to get it working correctly. If anyone has ideas on how to make it look better (fixed width compositor buttons, perhaps? dunno.) I'll be happy to hear.

I also duplicated some code from the Dot3Bump demo (the one that shows the cursor and only rotates the screen when a mouse button is down) because I needed a similar interface.
In fact, all menu-heavy demos do. Should this be part of the sample framework rather than individual demos?
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by xadhoom »

Compositor demo works great! Just one of the checkboxes overlaps the menu box and is not clickable there.
BTW: I recognise this mysterious steady lag (around one time per second) in the deferred shading demo while having 50 frames (Release, with AO).
Maybe its related to the same lag often observed around the forum.

@Omniter: How about adding key up/down to cycle the samples, too? And maybe the return key to start the demo?

xad
Last edited by xadhoom on Tue Nov 03, 2009 12:14 pm, edited 1 time in total.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Made some minor visual adjustments to the compositor demo, looks cleaner now.
I should add some dynamic method of determining number of compositors per page from the resolution of the window...
xadhoom - I don't exactly understand the issue you're having. Can you post a screenshot of the problematic situation?

Also, I ported the ParticleGS and Isosurf demos to the new framework, they are all in SVN. So, all the samples that I ever touched are ported. (Except for the RTT visualization in the compositor demo, which will be done soon).

Is there a list of demos that still need porting?
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by xadhoom »

Sure!

If I hit the checkbox outside of the menu rectangle the click is ignored...
Attachments
sbp.jpg
sbp.jpg (10.41 KiB) Viewed 4212 times
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Ah - that should have been fixed by the adjustments i talked about in the last post. Shouldn't happen anymore...
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by xadhoom »

Confirmed! Thank you!

xad
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Noman: Definitely looks great! Good job! :)
xadhoom: Sounds good. I'll add that on.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Instancing demo also ported to the new framework.

From a short survey, the ones still remaning are :
  • GUI
  • Ocean
  • Shadows
  • VolumeTex
  • Water
I think they are mostly GUI heavy samples, which I guess explains why they weren't ported yet. I actually had quite an easy time porting the CEGUI-using samples to the framework, its quite convenient. The resulting samples happen to be simpler to read, IMO.
The GUI sample will naturally still use CEGUI, but it might be a good idea to change the rest of them to use OgreBites. Gives the samples a similar (and Ogre-ish) look, making them easy to use...

There are a few that I'm not sure about :
  • EnvMapping - There used to be a sample like this but I don't see it anymore. Does it even exist?
  • Paging - Is this the start of a paging sample? Doesn't look like it does much right now...
Am I missing anything?
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Noman, from a previous post:
omniter wrote: I merged RenderToTexture into CubeMapping. Planar reflection render-to-texture is already demonstrated by the Fresnel demo, so I basically made the CubeMapping demonstrate dynamic cubemapped reflections. I used one camera to render the scene at 6 different angles to 6 faces of a cubemap texture. The sample shows a fish swimming around an ogre head. The ogre head reflects the fish, the floor, and the animated skydome. I also renamed EnvMapping to SphereMapping, as environment mapping encompasses both sphere mapping and cube mapping, and the EnvMapping sample only demonstrates sphere mapping.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by Noman »

Ok, cool.
Ported the water demo as well. Its a bit rough around the edges (mostly with stopping/resuming), but its working ok.
Thats it for this batch, have to get back to university stuff...
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

I gotta say, Noman... I don't know how you manage to keep up with school while at the same time be able to do all this too. Great job! :)
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Okay, I've got the arrow key cycling and enter key start/stopping done. Someone's gonna have to check it out though, because my build's broken again. It should be okay. Gonna work on the startup sample feature now.
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by omniter »

Okay, finished the startup sample feature. Once again, someone please check to see that it works. From what I can see, it should be fine. Just add "StartupSample=Title of My Sample" to the end of "samples.cfg". Also, I've renamed the "Sample" setting to "SamplePlugin", because it was misleading. Sample plugins can have many samples in them, and if we throw in a "StartupSample", people will be tempted to write something like "StartupSample=Sample_CelShading", which is not correct.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: [SoC 2009 - Accepted] Unified Samples Framework & Browser

Post by sinbad »

About Paging, yeah it doesn't do much now except to prove that the framework hangs together and does the right thing. Once I've finished with the Terrain I need to decide whether to merge the two demos or not.

@omniter: please don't commit things to your soc09 branch anymore, that's 'closed' now that it's been merged. Please commit refinements to trunk.
Post Reply