Thanks for the reply. The main concern is code reuse. I only need 2D graphics but may have some translate and rotation animations. Can WebGL and HTML5 compile the same code for andriod,IOS and web app with minimal change?
Is C++ a better option for portability?
Found this but dosen't seem to be able to support web.
https://msdn.microsoft.com/en-us/library/dn707591.aspx
Sorry, abit noob on cross-platforming.
First of all, you need to be very clear on what are you developing for on all the platforms involved.
Are you creating native desktop applications on the desktop, or are you creating web applications for desktop running in browsers ?
If it is the former, then Java is one possible language you can consider. Java can be run on Unix(mostly Linux or BSD or Mac OS X for consumers) and Microsoft Windows. While there are other language such as Python, Perl, Ruby which can also be run on the client system natively, the problem is these languages do not on their own provide the Window(UI) components. They mostly do it via 3rd party libraries which you will need to sort out for cross platform compatibility. 2 well known GUI frameworks I knew are GTK and QT, but there are also like what you mentioned OpenGL via GLUT.
For web applications, then your choice on the client side is very clear. It's going to be Javascript, HTML5, WebGL, SVG, CSS3.
For your native mobile platforms, most projects are only going to support Android and iOS. Whether you want to throw Windows Mobile into the mix will depends on your appetite. Supporting Android and iOS would cover a good number of audiences already. Android development is using Java and iOS is using either Objective-C or Swift. These 2 platforms have no inter compatibility to speak. So if you are going for native applications, you will need to develop one for each version. There are some cross platform framework such as PhoneGap or Xamarin. But really these days I really didn't hear much about them for projects I knew around me. Problem is for projects that requires some native features of the mobile platform, they rather do it natively for the specific platform instead of using these bridging mobile platforms. If they don't need any native features, then simply a web application running in the browser on the mobile smartphone will do.
So far, web development will be the most cross platform compatible and easiest to deploy since there is almost no need client deployment at all. You will need a server running your server technological stack to serve contents to the browsers/clients. Your clients just run on HTML5, Javascript, CSS5 and some other web technologies and that will do. Just point your clients to your web application URL.
Most web technologies do not require compilation. Javascript are interpreted by the browsers' Javascript engines and do not require compilation. Same goes for HTML5 and CSS and even SVG.
If you just need 2D graphics, then you need to consider what kind of 2D graphics are those ? Are they going to be bitmap heavy or vector heavy. Bitmap heavy solution will involve HTML5 Canvas, which you will need to manipulate low level drawing routines via the Javascript. SVG will provide vector drawing capability which can be manipulated via Javascript and styling.
HTML5 Canvas is just a drawing board, so you can draw anything on it, even a 3D application can be rendered onto it during the 3D to 2D conversion phase. SVG can somewhere provide pseudo 3D effects too, but limited and definitely not going to be as good as a raytracing engine provided by 3D engines even if these 3D engines are written in Javascript.
Maybe you want to be more forthcoming with what are you trying to achieve instead of just merely asking for a general cross platform compatible technology.