Cross Platform using C and Opengl

I'd like to hear some thoughts about cross platform programming. I want to run programs on Android, iPad, iPhone, Mac, and yes, Windows. I need intense hardware accelerated graphics, so I use Opengl and C. I have found that code to be portable to everything and I use a wrapper for each platform. The wrapper is needed only to give me an opengl window, internet access ala geturl or equivalent, and of course, user touches. GUI is also entirely in Opengl since I don't want to recreate a different GUI for every platform.

Another option to consider is using a 3rd party software stack that does all of the abstraction for you. A popular example of this is Unity (which can build applications for all of the platforms you mentioned).

Ditto. Except that I'll add that I use SDL for audio, input, etc. SDL and auxiliary libs like SDL_mixer provide a great cross-platform solution for non-graphics parts of my games. Also, some of my games use OpenGL for graphics and some use the SDL graphics capability.

SDL 1.3 supports iPad, iPhone, and Android. I'm still using SDL 1.2.14, but I plan to port my custom game engine to SDL 1.3 later this year when I port one of my games over to IOS for the first time. You'll find SDL 1.3 over at the Galaxy Gameworks site: http://www.galaxygameworks.com/products.html

My Game Company
Creator of Dirk Dashing, Rick Rocket, and Fashion Cents Deluxe

This is essentially what I use as well: SDL for application level stuff, SDL_mixer for sound, SDL_image for texture loading, OpenGL for graphics, written in C++. It's worked phenomenally for me, and I've been using this combo since 2004.

Do people really still use SDL_image for texture loading? In my experience getting SDL to load textures correctly so that it supports more than just formats that SDL decides to decompress directly to 32bit RGBA is a real PITA. Certainly more so than using libPNG and libJPEG directly, and certainly a lot slower if you load a lot of large textures.

The libPNG bundled is probably pretty ancient, but this will load palleted or grayscale PNGs with no trouble, will load them correctly for OpenGL (SDL_image makes them upside down), and can easily be changed to load alpha or luminance textures:http://files.slembcke.net/misc/PNGTexture.tar.gz

(Jan 13, 2012 02:28 PM)Skorche Wrote: Do people really still use SDL_image for texture loading? In my experience getting SDL to load textures correctly so that it supports more than just formats that SDL decides to decompress directly to 32bit RGBA is a real PITA.

I've actually never had a problem with it. I don't do anything crazy with it, just use the one line call to load pngs and jpegs. But it's never misbehaved on me.

(Jan 13, 2012 01:57 PM)JustinFic Wrote: OMG. You just made my day. How did I never see that site? I know it's pre-release but I want to work 1.3 into my engine asap.

Heh! You're welcome!
I use FreeImage to load the various graphic file formats for my game. It's nice to be able to load any image format with the same small block of code (versus dealing with all the individual libraries for the various file formats), and the performance is decent.

My Game Company
Creator of Dirk Dashing, Rick Rocket, and Fashion Cents Deluxe