window system + SDL2 sample browser input merge

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

window system + SDL2 sample browser input merge

Post by holocronweaver »

At long last, I am ready to merge my window system + SDL2 sample browser input into upstream OGRE. I have very little time to do this, no more than an hour or so a week, so I need to do this in a very time efficient manner.

For those not familiar, the new window system separates windowing code from the render system and makes adding support for third-party windowing libraries (SFML, GLFW, etc.) into OGRE fairly straightforward. The hope is that this will allow a single window system to be used for multiple render systems, reducing code duplication, simplifying OGRE as a whole, making the lives of OGRE devs a bit easier, and giving users choice of both render systems and window systems. It also adds much more robust windowing options support. For example, the SDL2 window system supports selecting monitors in a multi-monitor setup and borderless windows without any modification to a particular render system.

Included alongside this change is the replacement of OIS with SDL2 for input handling in the sample browser. As discussed in a previous thread on the topic, this was done because OIS development has been stagnant for a long time and a more modern and well maintained cross-platform input library was desired, one which the OGRE devs would not have to apply special patches to and maintain themselves as they have with OIS. SDL2 has already been added to the ogredeps repository, so Windows and Mac users should be set, while Linux users can obtain SDL2 via the. Mind you SDL2 is only required for the sample browser. You can still use OGRE without SDL2, but if you want to run the samples you will need SDL2, just as you needed OIS for the same purpose in the past. The main difference from a user perspective is that OIS was bundled with OGRE, but you will have to obtain and install SDL2 yourself, which has been made easy on all major OS as previously mentioned. Instructions will be added to the wiki.

Under the new window system paradigm, a window system is required in order to run OGRE, it is not optional, and you can potentially offer users the option of selecting from multiple window systems. Each window system can support any number of render systems. Currently only GL3+ and D3D11 render systems have supporting window systems, via SDL2 and a native Windows windowing system respectively. On the plus side, I have tested the SDL2 window system on Windows 7, Mac OS X 10.10 and Linux (kernel 3.19), so all major desktop OS are supported. The other rendering systems will not function until either a dummy window system is made for them or (preferably) proper window system support is added.

Given that I dedicate all my free time to side jobs and making my own game, I do not have time to create any additional window systems, so without outside help only the GL3+ and D3D11 render systems will work.

With this in mind, I propose the following two paths of merger:

A) Make the window system available as a branch of Ogre 1.10 and allow volunteers to add window systems to support the remaining rendering systems. When all or most render systems have supporting window systems, merge into default (1.10 proper).

My work was done in the default OGRE branch, so in theory it is well suited for upstream 1.10, but as mentioned only the GL3+ and D3D11 render systems have window system support.

If there is a strong demand and contributors volunteer to add window system support for a particular render system, I will go this path. Please only volunteer if you are serious because I do not want to go through the bother of merging and creating a branch for 1.10 only for it to be abandoned because no one wanted to add window systems for the remaining render systems.

This is a somewhat risky approach since it relies on volunteers, but since it seems many people are still using Ogre 1.* (including myself) it could be worth the effort. If you agree, and especially if you are willing to contribute to window system support, please say so. If there is enough support, I will throw together a rough guide for adding new window systems and porting existing render systems.

(Currently there is no proper documentation for the window system outside the Doxygen comments, so I will need to write such a guide shortly anyways.)

A downside to this approach is that a subsequent merge into 2.1 will have to occur, so it is more costly for me overall, but I would be willing to do that merge within a few weeks of the 1.10 merge being accepted. The OGRE community has given me allot, and I want to give back!

B) Skip 1.* and make the window system an Ogre 2.1 feature.

I will go this path if not enough people are willing to add window system support for the remaining 1.* render systems. The changes between 1.* and 2.* are large enough that instead of directly merging my work, I will probably have to reapply it by hand, but I am guessing this will overall be less work for me than directly merging into 1.10 and then subsequently 2.1, so it will get done faster. Plus the only render systems which 2.1 currently supports will be supported out of the box so it should be able to be included mostly as is with the 2.1 release, no extra volunteers needed. This is the safe choice - I can almost guarantee it will work out, but it will leave 1.* users behind. Maybe that is a good thing because it will encourage users to switch over? I am not sure about that as I had trouble with the transition myself (more a lack of time than any fault of the 2.1 design, which is fairly good overall).

Addendum

Regardless of which of the above paths are chosen, I have a Volume octree pager and some GL3+ and OGRE core work that I plan to merge into OGRE 1.10. Eventually these changes should be merged into 2.1. From quick scans of the effected code in both 1.10 and 2.1, I don't expect these changes to conflict much with upstream, except for a small set of GL3+ changes I will proably just discard. These merges will be done separately, within a month of the above two changes being accepted.

ETA timetable
The window system merge should be ready for acceptance into upstream by late September / early October, and the remaining changes should be merged sometime during October.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: window system + SDL2 sample browser input merge

Post by paroj »

note that in parallel I also picked up your SDL2 Sample Browser work and polished it for merging into default
https://bitbucket.org/sinbad/ogre/pull- ... mples/diff

currently it just needs someone to test it on windows and OSX. If you could just test my branch and report back, it would probably save you some work overall.

Also the 2.1 branch does not use the SampleBrowser architecture any more, but instead already uses SDL2 directly to fuel the samples
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: window system + SDL2 sample browser input merge

Post by holocronweaver »

Hi paroj. Was not aware of your work! Will give it a spin. I see mention in your commits of touch support. Did you test on iOS or Anrdoid?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: window system + SDL2 sample browser input merge

Post by paroj »

no the touch related stuff is untested. I just took care of passing the right SDL2 event to the according code.

Eventually I want to test it on Android, however it requires more work as Ogre never used OIS on Android - it grabbed the native events and merely wrapped them in OIS.

This is the discussion regarding my changes BTW:
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=82915
User avatar
TheOnlyJoey
Halfling
Posts: 53
Joined: Sun Apr 10, 2011 12:05 pm
Location: The Netherlands
x 6
Contact:

Re: window system + SDL2 sample browser input merge

Post by TheOnlyJoey »

I actually just got the right to take over the OIS repository's this week and start cleaning that up and picking up active development.
We have been using and improving OIS for the last 3 years and will start committing some of our code to the repository next week.

Though I do find the option to use SDL2 a good idea (since I love me some SDL), I am opposed to dropping OIS as a supported lib for OGRE, primarily since SDL2 is a one size fits all solution, but having the option to stay 'native' or just swapping the input, windowing etc is a good one.
Things like feature completion, better Android support, bugfixes etc will be arriving soon in http://github.com/wgois
I will also look at merge requests people have made on branches and the Sourceforge and add them to the repository.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: window system + SDL2 sample browser input merge

Post by holocronweaver »

Good to hear OIS is alive and kicking. OIS was the first open source input library I ever used and holds a special place in my heart. :)

Input for OGRE apps is completely handled by the developer - OGRE is input solution neutral and has no way of knowing what input system an app uses. You can use whatever input library you want. The choice has nothing to do with OGRE.
SDL2 is ONLY required in order to build the Sample Browser. We had to handle input in the Sample Browser somehow, and as per discussion in the previously linked thread we settled on SDL2 to replace OIS for this purpose. You can still use OIS in your OGRE projects.

To be extra clear: the choice of input library typically has nothing to do with the choice of windowing system, though you may choose to use the same library for both. You could use SDL2 windowing + OIS input if you so desire.

On a related note, in the mentioned thread we also discussed adding an input system to OGRE, but since most input libraries are very thin and have little to do with the renderer we decided to leave input handling entirely in the hands of the user. If a particular input system needs info from the window system (such as a sytems-specific window handle), we can add an accessor to the OGRE window system API so the user can get the info they need.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: window system + SDL2 sample browser input merge

Post by holocronweaver »

Ok, since no one seems to be volunteering to add window system support for 1.10, I will go with plan B and make the window system a Ogre 2.1 feature. I am kind of happy it turned out that way since it probably means less work for me, and I personally plan to stick to 2.1 anyways. However, I will still merge my volume octree pager into 1.10, and possibly some of my GL3+ and core work if I think it will be useful to anyone else. I will try to get the window system integrated into 2.1 in the next couple weeks, then within the next month merge the rest into 1.10.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: window system + SDL2 sample browser input merge

Post by paroj »

did you have some time to check my SDL2 SampleBrowser branch? If you could confirm that it works on OSX/ Windows that would help.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: window system + SDL2 sample browser input merge

Post by paroj »

Post Reply