Rendering Glitch on Mac OSX El Capitan with OpenGL

后端 未结 4 1326
滥情空心
滥情空心 2021-01-14 06:24

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 wh

相关标签:
4条回答
  • 2021-01-14 06:58

    For anyone else having problems with graphical glitches on OS X El Capitan and pygame, you can follow these instructions to downgrade to SDL from version 1.2.12 to 1.2.10, which seems to fix the issue (at least in several of the games I've tested so far):

    All the following is from the command prompt:

    1. Backup the original ruby Formula (just in case):

      mv /usr/local/Library/Formula/sdl_image.rb /usr/local/Library/Formula/sdl_image_backup.rb

    2. This creates a new Formula using the sdl version 1.2.10 instead:

      brew create https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz

    3. It should open in a text editor automatically, if not open it with vim/emacs/nano/whatever you prefer and edit it to match most of what the original sdl_image.rb (now sdl_image_backup.rb) says, but skip the "bottle do" part and the "test" part.

    4. Set environment variable (not sure this is required but worked for me):

      export SDL_CONFIG=/usr/local/bin/sdl-config

    5. Unlink the old 1.2.12 install:

      brew unlink sdl_image

    6. Now reinstall, but brew will use our new Formula for 1.2.10:

      brew install sdl_image

    0 讨论(0)
  • 2021-01-14 07:00

    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.

    0 讨论(0)
  • 2021-01-14 07:05

    I am having the same issue with my graphics in software. I am using SDL 1.2 and SDL_image 1.2.12. I tried to change the format of images that I am loading with SDL_image as SDL_Surface * const surface = IMG_Load(filename);

    but nothing worked. At the end, as a quick fix, I changed my graphics to BMP (disaster) and load them with pure SDL's function:

    SDL_Surface * const surface = SDL_LoadBMP(filename); 
    

    After that I don't have the glitches anymore. This is not final solution especially if you have lot of graphics.

    0 讨论(0)
  • 2021-01-14 07:09

    saltycraig's answer worked for me, but I had to figure a few things out on my own that I thought I would include here so people don't have to struggle to figure it out.

    First, when you're in step 3 and changing your new sdl_image.rb to match the backup, make sure to keep the url from the new one, containing this address: "https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz". That may seem obvious, but I didn't figure it out until my 2nd or 3rd time looking it over.

    Second, even after unlinking sdl_image and installing 1.2.10, you may need to delete 1.2.12. For me it was in usr/local/Cellar/sdl_image because I brewed python to get around El Capitan's new SIP preventing me from installing pygame.

    0 讨论(0)
提交回复
热议问题