Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a cross-platform method for basic 2D/3D graphics for iOS and Android

I'm developing an application separately for both Android and iOS using their native SDKs. However, there's a some module in the application that should support basic 2D (it can also be 3D) abilities such as tilting, scaling, rotating of vector graphics + all kinds of optional fancy effects on simple textured planes for example.

I'd like to host this module inside some kine of a view and that its code will be shared between both the iOS and Android platforms, as much as possible.

I've been lurking around the web for all kinds of solutions.

  1. First of all there's OpenGL, the problem is that I'm not familiar with coding for OpenGL and I wasn't able to understand if the code I will be writing with OpenGL will be shareable between the 2 platforms. It seems like no one actually had really tried to do it with NDK and such.
  2. There are platforms like

    a. Clutter (http://www.clutter-project.org/) - Which I couldn't find any example for its usage on mobile devices.

    b. Platforms like Unity3D, though I don't think they could help me much because as far as I understand the whole application must run on their platform, and that's not what I'm looking for.

So, do you guys think that it is feasible to share 2d/3d code between the iOS and Android? If so, is there any method you could recommend?

Or should I just go with each device's native method for 2d or 3d graphics?

Thanks!

like image 487
Dror Avatar asked Mar 12 '12 20:03

Dror


People also ask

What's a cross-platform app?

Cross-platform mobile development is the creation of software applications that are compatible with multiple mobile operating systems. Originally, the complexity of developing mobile apps was compounded by the difficulty of building out a backend that worked across multiple platforms.


3 Answers

Kivy: an open source cross-platform programming language for writing OpenGL-powered drawings, interfaces, visuals, anything, for Linux, Windows, MacOSX, Android and iOS. kivy.org

You can potentially drop using Android or iOS native widgets for Kivy widgets and you're apps will have the same OpenGL-powered interface on all platforms.

EDIT 9/27/11 1pm: I've done some more research. All in all, you should check out these 4 open-source frameworks for yourself and decide which one is best for you (I could list commercial frameworks, but those are easy to find):

  1. Kivy (kivy.org)
    • Amazing GUI and Widgets library.
  2. HaxeNME (haxenme.org)
    • Very nice 2D/3D API for making OpenGL graphics.
    • Amazing cross-platform support. The best of all the frameworks.
    • Unfortunately, no GUI or Widget library is built in though.
  3. Qt Quick QML (qt-project.org)
    • Very nice 2D/3D API for making OpenGL graphics.
    • Similar to HTML, but for OpenGL. Already know HTML and JavaScript? QML (Quick Markup Language) includes basic necessities like text fields, radio buttons, check boxes, etc, which can be animated and controlled with event handlers. Animations, event handlers, etc, in your QML application are written in JavaScript; the difference is the JavaScript gets compiled instead of interpreted.
    • Qt Quick is really amazing; my personal favorite. Read up on Qt Quick QML then try the Animated Tiles app for Android to see Qt Quick's potential. The newest release of Qt (coming very soon) support iOS, Android, and Blackberry, and all desktop OSes. Windows Phone is a work in progress but will arrive soon considering that Qt Quick already supports Windows 8's Metro platform. Qt Quick is very nice, but it doesn't work on every single platform like HaxeNME does.
  4. MoSync (mosync.com)
    • A hidden gem. This framework needs more exposure. The MoSync SDK provides a cross-platform OpenGL framework, an HTML/JavaScript framework similar to PhoneGap, a NativeUI framework for writing apps across platforms that use each platform's native UI widgets, and MAUI for writing C++ GUIs.
    • If you were gunna settle on just writing pure OpenGL, then I'd at least recommend checking out MoSync, as it provides a 1-to-1 implementation of OpenGL ES 1.0/2.0.

Also, if your app will be form based (not so much animated like a game), then PhoneGap might suit your needs. If you use the right features of HTML5, you can make apps that feel native (unlike the many horrible and discouraging examples out there). If you'd like to try an app made with PhoneGap that feels "native", try "Go 2012". The Go 2012 apps proves that if you use HTML5 correctly, you can take advantage of hardware acceleration across platforms (iOS, Android, Blackberry, and Windows Phone (I tested it on all)). The animations (scrolling, etc) in Go 2012 are all CSS3 hardware-accelerated animations. Don't let the poor quality of most of the app in the PhoneGap showcase fool you!

like image 112
trusktr Avatar answered Sep 27 '22 18:09

trusktr


Use OpenGL ES and write the code in C. Write a NDK wrapper for Android. Theoretically, your open GL C code should be reusable between the 2 platforms.

like image 27
Peter Cetinski Avatar answered Sep 27 '22 18:09

Peter Cetinski


Have you ever herd about small company name Adobe

Try using Air.

People do not appreciate the hard work that Adobe did, but it is the most strong cross platform available in market!

It support:

  • Windows with DirectX access to speed up your app, both in 3D and 2D.
  • Linux
  • Android (2.2 and above) with OpenGL background
  • iOS with OpenGL
  • BlackBerry

And many more... If you wish to work on the high level, use Air!

like image 36
Ilya Gazman Avatar answered Sep 27 '22 20:09

Ilya Gazman