Search code examples
macosopenglsdlmac-app-storeosx-elcapitan

Rendering Glitch on Mac OSX El Capitan with OpenGL


I created a tennis game for OSX using SDL 1.2 + OpenGL 1.1 .

Everything was ok till El Capitan. Now, a few textures aren't displayed correctly.

The court white lines are now black ; the player textures are all bad ; the energy bars on the left are all black: glitch#1

The white lines on the icons aren't normal. The rainbow texture on the highlighted icon isn't either: glitch#2

glitch#

How the game should normally looks: How the game should normally looks

So the wrong textures are:

  • the players : they are re-created in-game using different textures, using RGBA
  • the white lines (now black) : normal RGBA texture
  • the energy bar (on the left) : normal RGBA texture
  • some other GUI elements, but not all : mostly normal RGBA textures

Moreover, it's only the AppStore version of the game that gets these glitches. The version I distribute from my website seems to be glitch free ( => http://www.managames.com/predownload_en.php?f=TennisElbowMac_sto.zip )

I'm totally puzzled by what's going on. I know El Capitan just brought a big change in the way the OS renders things, but I have no idea where to look and even less what to fix.

It seems it only touches RGBA textures, but not all of them as most GUI elements are still correctly displayed.

So thanks in advance for any tips you may have !


Solution

  • Thanks to the help of Sidney Markowitz from this thread => https://lists.gnu.org/archive/html/enigma-devel/2015-10/msg00001.html , I figured a solution : replacing SDL_Image 1.2.12 version by 1.2.10 version.

    If I got this right, the catch is that 1.2.10 comes with old universal code which is not allowed on the AppStore, so submitting an App with this version would likely end in a rejection. So I'm going to try to recompile it with only x86 code, that should likely do the trick.

    EDIT:

    Instead of recompiling, I just used Lipo ( http://www.manpages.info/macosx/lipo.1.html ), like this :

    lipo -remove ppc -output ~/Documents/SDL_image /Library/Frameworks/SDL_image.framework/Versions/A/SDL_image

    And then moved back "~/Documents/SDL_image" to "/Library/Frameworks/SDL_image.framework/Versions/A/" . And finally I edited its info.plist to fix the Bundle ID (needs 2 dots in it) so publishing on the AppStore could work.

    Thanks again to Sidney Markowitz for the Lipo hint ! :-)

    EDIT2:

    New version has been rejected by Apple, because SDL_image 1.2.10 uses a deprecated CGDataProviderCreate API. The code contains a "#ifdef" to use a newer replacement, so I'll have to recompile it instead of using Lipo, but I'm afraid this newer replacement is the actual source of the glitch on OSX El Capitan.

    EDIT3:

    Recompiling SDL_image 1.2.10 works, but not as it, I had to change the installation folder to @rpath and a few other parameters and then it was successfully accepted on the AppStore.