Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android/iOS "Soon"  (Read 41414 times)

0 Members and 1 Guest are viewing this topic.

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Android/iOS "Soon"
« Reply #15 on: August 14, 2013, 11:36:05 am »
GlxContext::selectBestVisual() was added by Laurent when commiting "Fixed ContextSettings ignored on Linux when creating a window (#35)" 24 days ago.

As far as I can see, GlxContext was not used in WindowsImplX11.cpp before, so EglContext didn't have to be included neither.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Android/iOS "Soon"
« Reply #16 on: October 09, 2013, 12:10:38 am »
Any chance we could get an update on how the Android/iOS ports are going?

iroquai_tribe

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Android/iOS "Soon"
« Reply #17 on: October 09, 2013, 12:51:11 am »
This is my first post so, first of all, I would like to congratulate everybody on the SFML team.
I've been using SFML for a while so I think it's time to participate in the forums and join this awesome comunity.

I've downloaded Sonkun's eSFML and tried to make it work in a raspberry pie without success. I stumbled in the same problem as Ghosa: the undefined reference to
sf::priv::GlxContext::selectBestVisual(_Xdisplay*, unsigned int, sf::ContextSettings const&);

I digged a little bit and found that the _EGLContext class is missing this method. Should it be declared in the GlContext class and then defined in the _EGLContext class (I'm no expert at all in this... just trying to guess  :P)

Is there any way to fix this? As described by Ghosa this happens when linking with the -lsfml-window flag.

Thanks  :)

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Android/iOS "Soon"
« Reply #18 on: October 09, 2013, 11:28:03 am »
Best way would bei to Include EGLContext in WindowsImplX11.cpp
and to add the Method "selectBestVisual"

The Problem is that you can't calculate the BestVisual with EGL in the same way as GLX.

But for a quick fix you can just return the first XVisualInfo.
Worked for me, but you might noch get Antialiasing.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Android/iOS "Soon"
« Reply #19 on: October 09, 2013, 11:42:02 am »
Android and iOS ports are implemented. Now we are busy adjusting some details and fixing a few things that don't work as expected.

I don't think Jonathan still maintains the eSFML repository, you should rather wait for the new code to be available. We'll try to push it to the public repository before the end of the month if possible.
Laurent Gomila - SFML developer

iroquai_tribe

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Android/iOS "Soon"
« Reply #20 on: October 09, 2013, 01:05:52 pm »
Hi!

We'll try to push it to the public repository before the end of the month if possible.
That's great news! I'm eager to see the performance of the raspberry using SFML. I think both the Android and the iOS ports will be a major addon to the library and open the door to many other developers who use those platforms.

But for a quick fix you can just return the first XVisualInfo.
Worked for me, but you might noch get Antialiasing.
Meanwhile, I'm going to try Ghosa's sugestion just to get things going :)

Thank you both!

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Android/iOS "Soon"
« Reply #21 on: October 09, 2013, 01:32:16 pm »
Yeah, great news :-).

@ iroquai_tribe
If you want it, i could give you my fix when I get home.

iroquai_tribe

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Android/iOS "Soon"
« Reply #22 on: October 09, 2013, 03:16:46 pm »
If you want it, i could give you my fix when I get home.

That would be awesome, thanks :)

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Android/iOS "Soon"
« Reply #23 on: October 10, 2013, 01:12:34 am »
Android and iOS ports are implemented. Now we are busy adjusting some details and fixing a few things that don't work as expected.

That's really excellent news, congrats! I'm really looking forward to deploying SFML hello world on my ipad! :)

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Android/iOS "Soon"
« Reply #24 on: October 10, 2013, 04:04:49 am »
Next step: WebGL? :p

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Android/iOS "Soon"
« Reply #25 on: October 10, 2013, 09:29:34 am »
That would be awesome, thanks :)

OK, here is the quick an dirty fix to make the ESFML-Code on Github run with EGL under Linux.
I don't have my AC100 here to test it, so I hope I didn't forget anything:

WindowImplX11.cpp
Change Line 31:
#include <sfml/window/Linux/GlxContext.hpp>
to:
#ifndef SFML_EMBEDDED_SYSTEM
        #include <sfml/window/Linux/GlxContext.hpp>
    #else
        #include <sfml/window/Linux/EGLContext.hpp>
    #endif


Change Line 152:
XVisualInfo visualInfo = GlxContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);

to:
#ifndef SFML_EMBEDDED_SYSTEM
        XVisualInfo visualInfo = GlxContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);
    #else
        XVisualInfo visualInfo = _EGLContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);
    #endif


EGLContext.hpp

Add:
    static XVisualInfo selectBestVisual(::Display* display, unsigned int bitsPerPixel, const ContextSettings& settings);


EGLContext.cpp

Add:
XVisualInfo _EGLContext::selectBestVisual(::Display* display, unsigned int bitsPerPixel, const ContextSettings& settings)
{
    // Retrieve all the visuals
    int count;
    XVisualInfo* visuals = XGetVisualInfo(display, 0, NULL, &count);
    if (visuals)
    {

        XVisualInfo bestVisual;
        //ToDo: Calculate best Visual        
        //select first Visual for now
        bestVisual = visuals[0];
        return bestVisual;
    }
    else
    {
        // Should never happen...
        err() << "No EGL visual found. You should check your graphics driver" << std::endl;

        return XVisualInfo();
    }
}
« Last Edit: October 10, 2013, 09:35:51 am by Ghosa »

iroquai_tribe

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Android/iOS "Soon"
« Reply #26 on: October 11, 2013, 01:43:32 am »
Thanks for the code! I think I tried something like that to fix the problem but I was having some problem with the "XVisualInfo" not being defined in EGLContext. If I recall correctly it is defined in the glext.h header file which is only included in the GlxContext. I'm not sure though... I'll definitely take a look at that this weekend.

Thanks  :)

game_maker

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Email
Re: Android/iOS "Soon"
« Reply #27 on: October 13, 2013, 12:22:04 am »
Excellent news. Thanks SFML-Team for your great job.

Pippers

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Android/iOS "Soon"
« Reply #28 on: October 13, 2013, 01:12:52 am »
How does something like SFML become available for IOS exactly? I've never done any IOS programming, but looking over it, it looks like it uses Objective C, which on a quick glance looks entirely different than C++. It also seems to use its own libraries and emulators to dump out the IOS executable. Is SFML just being ported to Obj C and will be a simple add-on into XCode or something? How cross platform compatible would the code even be for current projects?

Just trying to wrap my head around how that entire process works.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Android/iOS "Soon"
« Reply #29 on: October 13, 2013, 08:55:19 am »
It's not different than OS X, i.e. you can mix C++ and Objective-C in an iOS app. So this won't change anything for the end user, one can directly compile his C++ SFML application on iOS and Android and it will run fine.
Laurent Gomila - SFML developer