Should SDL be used as the GUI instead of Ogre?

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
User avatar
mrSpaceman
Space Floater
Posts: 31
Joined: Fri Apr 29, 2011 3:58 pm
Location: UK

Should SDL be used as the GUI instead of Ogre?

#1 Post by mrSpaceman »

To continue a discussion started in another thread: viewtopic.php?f=24&t=8988

I was working on fixing a specific bug related to Alt-TAB-ing in Linux. It seems that the solution might be to change the code handling the GUI to something which doesn't have this bug upstream. Having a well maintained upstream code might also prevent other bugs from being intractable problems.

Should work on changing from Ogre to SDL start as a priority? Will 3D elements available through Ogre be required later? If so could they be added without having to include OIS?

Any other solutions to the OIS being broken and development on it being dead? Could the code be subsumed into the FreeOrion project?

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: Should SDL be used as the GUI instead of Ogre?

#2 Post by Mitten.O »

On the other thread, Geoff wasn't sure how viable the SDLGUI of GiGi is.
I decided to find out.

This patch makes the minimum effort to test if FreeOrion would work with the SDL front.
Answer: yes.

I left a bunch of things unimplemented with dummies and stuff to get it to compile,
but the basic functionality is all there and I'm pretty sure all the holes can be patched
with just quick searches of the SDL documentation.

The only major weirdness is the drawing of detection,
but that is probably just an opengl setting issue.

Based on this experiment it would seem that moving to SDL is highly viable.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
mrSpaceman
Space Floater
Posts: 31
Joined: Fri Apr 29, 2011 3:58 pm
Location: UK

Re: Should SDL be used as the GUI instead of Ogre?

#3 Post by mrSpaceman »

Rapid work! 8)

My big question (I am monomaniacal about this point) is whether using SDL can help fix the Linux Alt-TAB issue. Do you think your patch would be able to allow this to be tested? :?:

I'll probably give your experimental patch a whirl and have a look at the effect on the Linux input (and specifically the Alt-TAB behaviour).

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#4 Post by vincele »

I'm trying the patch, and needed to install libsdl1.2-dev, libsdl2-dev did not get used despite being installed. This is for a debian linux distro.

And it looks like you forgot to add the new file GraphicsSystem.h to the patch.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: Should SDL be used as the GUI instead of Ogre?

#5 Post by Mitten.O »

And it looks like you forgot to add the new file GraphicsSystem.h to the patch.
Again. This is like trying to live without a calendar. I have offloaded the work of minding
this this to my version control system, but using two that are unaware of each other ruins it.

Hmm.. I wonder how crazy it would be to put my svn metadata under git version control
so that the information on which files are needed would be always up to date.

Nah it is propably best to just figure out how to make the git generated patches acceptable to
svn clients. Here is a git generated simulation of the svn patch.
It is correct and should be readable at least by the "patch" program.
I'm trying the patch, and needed to install libsdl1.2-dev, libsdl2-dev did not get used despite being installed.
Yes. The SDLGUI is apparently pretty old and uses SDL1. If we do decide to use it, it must be updated to SDL2.
The old SDL is getting deprecated, and lacks fairly vital features like switching between fullscreen and windowed without losing the OpenGL context.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#6 Post by vincele »

I currently use diff / patch & quilt. But usually prefer git over svn, for obvious reasons, but that's off topic...

I'll try to help with that patch, currently compiling, and you should put

Code: Select all

#include <GG/PtRect.h>
before

Code: Select all

#include "GraphicsSystem.h"
in GraphicsSystem.cpp to avoid

Code: Select all

In file included from /home/vince/repo/upstream/freeorion/FreeOrion/UI/GraphicsSystem.cpp:1:0:
/home/vince/repo/upstream/freeorion/FreeOrion/UI/GraphicsSystem.h:12:13: error: ‘GG’ does not name a type
     virtual GG::Pt CurrentResolution() const = 0;
or put the include line in the .h
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#7 Post by vincele »

All compiles properly, but the final link does not :

Code: Select all

Linking CXX executable ../../freeorion
/usr/bin/ld: cannot find -lGiGiSDL
collect2: error: ld returned 1 exit status
client/human/CMakeFiles/freeorion.dir/build.make:1398: recipe for target 'freeorion' failed
make[2]: *** [freeorion] Error 1
CMakeFiles/Makefile2:541: recipe for target 'client/human/CMakeFiles/freeorion.dir/all' failed
make[1]: *** [client/human/CMakeFiles/freeorion.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
mrSpaceman
Space Floater
Posts: 31
Joined: Fri Apr 29, 2011 3:58 pm
Location: UK

Re: Should SDL be used as the GUI instead of Ogre?

#8 Post by mrSpaceman »

I haven't tried the patch yet. However, I found this on the Ogre site:
http://www.ogre3d.org/tikiwiki/tiki-ind ... e=Cookbook

It might mean that Ogre can persist in the project. This might be a good thing if 3D graphics are used in the future), whilst allowing for an alternative to OIS for the input.

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: Should SDL be used as the GUI instead of Ogre?

#9 Post by Mitten.O »

or put the include line in the .h
True. Done.
All compiles properly, but the final link does not :
CMake caches the setting to not compile GiGISDL.
Purging the CMake cache definitely helps, but at least I got
away with just editing CMakeCache.txt manually and changing the line
BUILD_SDL_DRIVER:INTERNAL=OFF
to
BUILD_SDL_DRIVER:INTERNAL=ON.
I haven't tried the patch yet. However, I found this on the Ogre site:
Yes that looks promising. Based on the article it may be possible to entirely remove Ogre now and never fully wrap
ourselves in it again, just use it inside the combat where it's needed.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#10 Post by vincele »

Hello,

you v3 of the patch compiled and run with the cmake file cleanup.

I ran a very quick test run, there were visual glitches (garbled colors) and a segafault at close window (window manager (WM) button) time. I did not quit from the in-game menu, as I had to go. The mouse pointer was doubled (WM + in-game).

The game startup mouse takeover and window move seems fixed. That was kind of annoying for windowed mode.

More testing to follow later.

Thanks, this looks promising.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#11 Post by vincele »

Quick testing further notes:

* WindowManager windowed mode: window is not titled, and no icon
* prodwnd, production summary area, outlined in purple, but color flickering as mouse moves
* segfault at exit still when closing from in-game menu

look the attached screenshot for the previously mentioned visual color glitch
Image
The circles around systems are crap
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Should SDL be used as the GUI instead of Ogre?

#12 Post by Dilvish »

vincele wrote:* segfault at exit still when closing from in-game menu
There was an issue in the past (not clearly resolved I think) about the Debug version of the game (the default cmake build I believe) not doing a clean quit on exit, and I have a vague recollection that the abort messages may also have included a segfault message. So this issue may not be truly new to this patch. Could you include the full segfault message you get? And try compiling a Release build and see if you get the same issue?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#13 Post by vincele »

Gaaaah, just tried 5 times in a row without segf... forget about that comment.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: Should SDL be used as the GUI instead of Ogre?

#14 Post by Mitten.O »

Here is a version of SDL usage where the SDL has been updated to SDL2.
I fixed the missing stencil issue I had, but resizing and such are still not implemented,
but thanks to SDL2, they should be fairly straightforward to do.

It will be interesting to know if the newer version of sdl helps with the issues you reported.
I will have to dig into the ogre code to match the opengl settings it uses as closely as possible,
such settings are hopefully the cause of most problems (as was with the visibility radii rendering).

Also, no capital letter input at the moment.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: Should SDL be used as the GUI instead of Ogre?

#15 Post by vincele »

I'll test the new version, is the new patch SDL2-only ?
FYI my tests are only for linux version...
Win32 version will also need to be tested early, but I can't build it myself...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

Post Reply