0
\$\begingroup\$

I am currently learning OpenGL (3.0+) with C++. I am using SDL for input handling, window creation, etc., GLEW to use OpenGL and call OpenGL Functions, and GLM for OpenGL Math stuff.

If I fully finish a Windows game, how can I port my game with the setup above to Android, IOS, and maybe even other platforms (but my main focus is Android and IOS). I do not want to use any Game Engines.

What I am looking for is a program that could just make my game run on android and IOS. If there is a way to optimize my game using the tools listed above a little bit and change some code to make my game run on android and IOS, I am okay with that (if that is the case, please provide resources).

I have heard of OpenGL Es, not quite sure what that is, but I do not want to use it if it is a completely different library and if I have to rewrite the entirety of my game rendering engine. I also want my app to run without the user having to download any libraries such as SDL, so please make sure that my app can just run as an .apk file or whatever format that I can just tap on and it will open.

I also want my app to run on most smartphones (Android and IOS), so please be sure that what you are suggesting is not only available to a limited amount of smartphones. Another thing that I want is optimal performance. No emulators or simulators from .exe to .apk that run very slowly. It should run as fast as other apps and run at probably the same speed as my windows version. Also point out any mistakes that I may have made (for example, maybe I am just crazy thinking that smartphones use OpenGL).

\$\endgroup\$
  • 1
    \$\begingroup\$ If you are using a modern compiler then OpenGL ES and OpenGL should be directly compatible. SDL supports android through its own wrapper(not emulator). Can't speak for iOS. \$\endgroup\$ – akaltar Jul 14 '15 at 20:44
  • 1
    \$\begingroup\$ I managed to get my sdl code working in android by compiling it with emscripten, then it'll work fine in the browser... \$\endgroup\$ – tp1 Jul 14 '15 at 20:50
  • \$\begingroup\$ Downvoted for lack of minimal research effort \$\endgroup\$ – Ivan Aksamentov - Drop Jul 15 '15 at 6:06
3
\$\begingroup\$

If you're using SDL 2 you should just be able to port to mobile quite easily. SDL 2 has support out of the box for mobile. It won't be a 2-click port but it will be very possible to do.

Check out the download page: http://www.libsdl.org/download-2.0.php#source

There are versions of SDL 2 for iOS and Android that you can build from source. SDL is very well supported so it should require minimal effort. You'll probably need an actual Mac to do anything for iOS.

OpenGL and OpenGL ES are very similar. OpenGL ES is really just OpenGL for Embedded Systems (hence the ES). You will not have to rewrite everything from scratch. Your shaders may need some optimizations or tweaks to work perfectly on mobile however. The exact tweaks that you will need to make will depend on your application, your shaders and your target platforms.

Here are some READMEs that you should read:

https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-android.txt

https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-ios.txt

Don't be afraid to search around on your own. SDL is very widely documented and discussed.

\$\endgroup\$
  • \$\begingroup\$ Have you ever used SDL with android? How does it run compared to other apps written in android's native language, java? \$\endgroup\$ – Java Man Tea Man Jul 14 '15 at 21:41
  • \$\begingroup\$ I haven't used it directly but I'm familiar with JNI and C/C++ on Android. Performance is good in my experience. Obviously Google prioritizes their optimizations towards their Java compilers so C/C++ isn't a performance gain but it works as fast as any "native" Java application. \$\endgroup\$ – Honeybunch Jul 14 '15 at 22:07
  • 2
    \$\begingroup\$ How is the C++ not a performance gain? NDK exists specifically for performance-critical apps (such as real-time renderers). \$\endgroup\$ – Ivan Aksamentov - Drop Jul 15 '15 at 6:12
  • \$\begingroup\$ I remember reading (a while ago) that the NDK was not to be used unless you wanted the lower level interface to OpenGL. The performance gain over Java for general purpose was cited as negligible for most apps. Of course for something like OpenGL there is going to be a performance gain just due to the lack of a Java wrapper. \$\endgroup\$ – Honeybunch Jul 15 '15 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.