SDL_image visual glitch on OS X El Capitan

一世执手 提交于 2020-01-03 06:39:14

问题


When trying to load and display bitmaps using Allegro 5 in C or PyGame in Python (both use SDL), instead, it renders a glitch (see screenshot below).

I tried googling it and found that it could be related to SDL_image incompatibilities with OS X El Capitan, but no solutions. Anyone?

Currently, I tried:

  • Installing SDL_image 1.2.10 (latest compatible release). Nope!
  • Installing SDL_image 1.2.10 with Homebrew via a custom formula. Also nothing!

On the screenshot, those random pixels should be three red brick bitmaps. By the way, I'm using those functions to load and draw the bitmap, respectively:

tileset[0] = al_load_bitmap("./data/gfx/bricks.png");
al_draw_bitmap(tileset[0], pos_x, pos_y, 0);


回答1:


The bug is actually with SDL_image under El Capitan. There is a workaround by downgrading SDL_image to 1.2.10 (not SDL). It's possible you may have installed SDL 1.2.10 but still have SDL_image 1.2.12. Try removing and force installing the correct version.

See here for details:

https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-deprecated

I've tried this fix myself and Pygame is working fine under 10.11 now.



来源:https://stackoverflow.com/questions/34757499/sdl-image-visual-glitch-on-os-x-el-capitan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!