JOGL vs OpenGL ES API on Android. Pros&Cons - android

We are trying to migrate our project from PC version to Android. PC version uses JOGL.
Can anyone explain main advantages of using JOGL in Android application instead of OpenGL ES API?
For example, on PC pros of JOGL are:
In theory you can use it on any platform.
It's more or less integrated with AWT, Swing and SWT.
Also it's some kind of wrapper, so in theory there are some abstractions that make it easier to use OpenGL.
But I can't see advantages of using it in Android, here are the cons from my point of view:
It's another dependency, APK size will be larger.
Some issues that affect both JOGL and OpenGL ES will require more
time to pinpoint and fix.
It's not a silver bullet that would not require some time for
refactoring, since in Android we should use right patterns for
Activities, Services, etc.
JOGL has less tutorials and smaller community that OpenGL ES API
has.
So what's the point of using it in Android project?

You can use JOGL only on the platforms that we support. I confirm that JOGL has a good interoperability with AWT, Swing and SWT (not yet with OpenJFX/JavaFX but we'll improve that when Oracle does the necessary things). Yes there are some nice abstractions but you forget tons of things:
JOGL has its own AWT-free image management. It has a better support of JPEG than ImageIO and it is faster
You can preserve the OpenGL context even when your application is paused and put in background (when you press "home"), it's build-in
You can test your OpenGL-ES code on your computer even though it doesn't replace the tests on a real device
You can use exactly the same OpenGL code on desktop and embedded environments, especially if you already use GL2ES2
you can rely on us if something goes wrong, there are already a few commercial games on Google Play
I admit that there is a lack of documentation about JOGL under Android. I'm sorry, I have spent several months in writing a tutorial about JogAmp's Ardor3D Continuation and I prefer leaving the task of doing the same for JOGL Android usage to someone more experienced with it.
Edit.: Sorry for the late reply but I had a problem with my OpenID. Please rather post questions about JOGL on our official forum.

Related

Is this possible, GNOME (lib)Clutter with OpenGL ES & Vulkane?

I'm planning to run an app based on (GNOME) libclutter on Android 9 (Pie). I'm quite new to these graphics related stuff, been wondering on these things, so seeking for guidance/direction whatever data that could help me to understand this thing better.
As per the documentation of Android Graphics, Android is using OpenGL ES & Vulkane at low level to render objects. And as per GNOME Clutter documentation, it could be only compiled with mentioned back-end only! (Please check embedded link to for platforms details.)
I don't see OpenGL ES or Vulkane support, So am I missing something on understanding part or it can't be done?!
[Clutter maintainer, here]
Yes, Clutter supports OpenGL ES—it uses Cogl, a library that abstracts GL and GLES concepts.
No, Clutter does not support Vulkan at the moment.
No, Clutter and Cogl do not support Android; there was an experimental port but it has been abandoned in 2012.
Additionally, Clutter is in deep maintenance mode: no new development releases, no new features, and only minimal/security/crasher bug fixes are allowed.
I would not recommend using Clutter in a newly written project.
OKay...after spending few more hours, I was able to figure out an answer! (Yayy..!!!)
As per Clutter Project website: (somehow I had missed this info previously! :p)
Clutter uses OpenGL for rendering (and optionally OpenGL ES for use on mobile and embedded platforms), but wraps an easy to use, efficient, flexible API around GL's complexity.
So, as per my requirement, I should be able to integrate and cross-compile Clutter lib source and compile it.
PS: I will try to integrate & build the libclutter on android 9. Will update this answer latter with additional set of information.
==========================================================================
Update:
As pointed out by #ebassi in another answer, I have dropped the idea of integration and looking forward to directly using Android Graphics stack for the implementation.
Thanks #ebassi...!

SDL2 cross-platform OpenGL 3+ and OpenGL ES 2.0 or 3.0

Is there some super-easy basic hello world cube project (with setup tutorial) for SDL2 that builds and runs easily across (Windows, Linux eg Ubuntu, Mac OS X, Android, iOS), using modern OpenGL as in OpenGL 3.x or 4.x and OpenGLES 2.0 or 3.0?
I downloaded SDL2 and it was pretty easy to get their example testgles.cpp and testgl.cpp to build...
However, the testgl.cpp one is horribly old (gl2 style), so I tried the testgles.cpp. Unfortunately, even this is full of old style fixed function calls like glMatrixMode(GL_MODELVIEW). And it's annoyingly over-integrated with SDLTest_Common code.
Is there a better simple clean hello world project (eg colored cube, textured cube) that I can start from?
Or is there some reason why they don't include such an example starting project or tutorial?
Or should I be using a different library instead of SDL2 that is simpler & cleaner to setup? Basically I want to write OpenGL / OpenGLES (and maybe DirectX) cross-platform C++ code. But setting up SDL2 has been a lot messier and more painful than I expected.
So far I just made an svn repository with SDL2 code and got testgl.cpp and testgles.cpp to build on those five platforms. But that used a lot of old style OpenGL/OpenGLES code, so now I am slowly hacking it to use newer stuff... It's been quite a pain. I don't get why SDL2 doesn't just include a basic hello world cross-platform starting project (eg textured cube) using modern OpenGL/OpenGLES (and DirectX).
SDL2 is a good way to start. I could even say, that SDL is the most popular and yet multiplatform lib for that, especially is you think about using joystics or going steam later on. There is no need to look for any other lib. But please remember, that it's just low level layer for providing media access. It's not their job to provide high quality Opengl 3.0 projects to users. What you need is to learn some modern OGL basics - and you have to do it somewhere else. As simple as that.
A good place to start is http://www.open.gl. There is a couple of very straightforward and simple tutorials written in C++ with some SDL and SFML approach.
Lazy Foo also cover some of the topic http://lazyfoo.net/tutorials/SDL/
http://openme.gl/ is also nice, maybe http://openme.gl/opengl-4-x-example-using-sdl2-and-glm/ is something for you. It seems to be a quite good quality code.
http://www.opengl-tutorial.org/ is also a great place to learn OpenGL 3.3+. It's recomended in many places.
You can always come with some kind of project like this and link to official SDL wiki. ;) SDL community will be greatfull for that.
And by the way. DirectX is "Microsoft's non-opensource SDL" - and it's very non-crossplatform.
If you want to write cross platform OpenGL, you might take a look at GLFW for setting up your OpenGL context. It handles simple window and context creation as well as user input.
I have a method to render a colored cube in some of my example code here. It's pretty enmeshed in my library though as it makes lots of calls out to my wrapper classes. They're also available in the same library, or you can take a look at the latest version of them here.

Are there cross-compilable OpenGL examples made with Oxygene?

We have a working OpenGL project made for PC (works on MacOS and Linux under Wine as well) which we want to try to cross-compile to tablets. Delphi XE2/XE4 offers iOS support, but there's no Android yet and judging from iOS implementation history it might take 1-2 years. Now we start looking into other possibilities which will allow us to keep the majority of Pascal codebase (80k lines). So here's the question for the Oxygene:
Are there any examples of OpenGL applications made with Oxygene that can be cross-compiled to work on PC/MacOS/iOS/Android ?
If not, what alternatives are there (except Lazarus)?
AFAIK there is none.
Even the low-level Sugar cross-platform RTL is not finished. It would be a first mandatory step to be done before accessing higher level libraries in a cross-platform way (i.e. with identical source code), like OpenGL.
So with Oxygene, you have a great cross-compiler, but you are tied to use the RTL available on each platform.
You can compare with two object-pascal compilers:
With FreePascal, which has built-in OpenGL units, and already several libraries over it - one of the most powerful/known is GLScene;
With SmartMobileStudio, which has built-in WebGL support and can do amazing things on modern browsers - WebGL is a translation of the OpenGL API/concepts in HTML5.
Oxygene doesn't attempt to be source compatible with Delphi. What's more the runtime libraries used by the various Oxygene flavours differ entirely from those used by Delphi. So you won't find any serious libraries that have single source that can compile on Oxygene and Delphi.
The way that RemObjects have developed Oxygene on different platforms is quite interesting and radically different from the approach taken by Embarcadero with Delphi.
With Delphi the goal is that you can single source development for all the platforms. That is made possible by the FireMonkey framework which presents a common interface to all platforms. Obviously you need to vary some elements of an app to account for device differences.
With Oxygene, each platform is targetted separately. So for Windows, the runtime is .net. For Java it is the JVM and for Apple platforms you target Cocoa.
All this means that you cannot expect to write a GUI app in Oxygene and have it work on multiple platforms.
So not only can you single source your app between Delphi and Oxygene, you cannot readily single source multiple Oxygene targets.
Now, you can probably port to Oxygene or FPC without too much trouble. But maintaining single source is liable to mean a lot more effort. Whether that's worth the effort is debateable. In the long run you'll want a codebase in one of Delphi, FPC, Oxygene, or even something radically different. But you won't want your code spread out over multiple languages.
You can write or own OpenGL layer in Oxygene with the usage of mapped types like it is used in the sugar open source project.
It sounds pretty cool. In your code you have just to use one class which is during compiling direktly mapped to the underlying platform class method, without an overhead of that layer.
IMHO, when Oxygene is growing, we will then find a lot of such "suger" layers and write once compile anywhere will come closer :)
Edit:
Using OpenGL with .Net
OpenGL Java Tuturial

Android OpenGL libraries + software for prepare opengl graphic, practical usage

I would like to use OpenGL graphic on Android games and read some basic tutorial articles. I think it is very difficult, lenghty and long-time taking to prepare OpenGL code by hand. What is the practical way to prepare OpenGL code in real. Are there any editors to generate OpenGL objects code or any software it can help in generating of OpenGL code ? How do the companies prepare OpenGL projects ?
Quick response: Do some research with google for "android 3d engines" and pick the one that meets your needs.
From an opensource perspective, use any open graphics library out there (#andengine #libgdx #shadingzen...) as the main framework so that you don't need to write much of the complex OpenGL code. For creating 3D meshes you can use #Blender which supports many export formats and you can even write your own in python. There are some tons of examples on how to use Wavefront (.obj) objects in OpenGL (e.g. https://github.com/TraxNet/ShadingZen/blob/master/library/src/main/java/org/traxnet/shadingzen/core/shapes/OBJMesh.java).
There is not a OpenGL-code-generating-tool as you may think. OpenGL is an API which allows you to manage GPU driver states which is not enough to display objects, you also need to either write your own 3d engine (even if its very simple) or use any of the already made ones out there.
And again, do some research and find the workflow and the engine that meets your needs.
OpenGL is freakingly difficult to learn, for a newbie to Graphics programming. If you are comfortable with Java, then I would recommend you look into LibGDX. The way Libgdx or in fact any other gaming engine works is, they hide the difficulty of OpenGl programming by writing wrappers around OpenGL programs. So if you are comfortable with higher level language such as Java then working in Libgdx is much easier. Then you are good to go about your game.
The reason I have recommended Libgdx is clearly simple,
A) From outside i find they have a very active forum and lot of test code, demos.
B) Also the particle editors from Libgdx is something exceptional from a free Open Source point of view.
C) The ability to verify the output in the desktop is something exceptional, it saves hell lot of time.
It looks like AND engine or cocos2d the other free open source engines are no more as active as earlier. Probably they are having good time in Zynga ville :)

2D cross-platform game engine for Android and iOS? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I've worked for some time with Unity3d and found it's 2D part with OnGUI() or GUITextures too clumsy. Also, even a smallest game done on Unity3d is at least 10MB download which is just too much for a 2D game.
So, I'm currently looking for an engine for 2D. I've tried Cocos2D but it's iOS only and I wouldn't like to rewrite everything into another language for Android (so, e.g. Java port of Cocos2d for Android is not an option). Instead, I want to write the code once and with least hassle deploy it on iOS, Android and possibly Windows Phone 7. I have both Mac and Windows.
Just to be more detailed, here are my requirements to the engine:
must be cross-platform
must be efficient
should be C++, Java, C# or Objective C since I'm comfortable with them and NOT Flash, Javascript, HTML5 since I am not a web developer
must have a large community, tutorials, additional libraries which cover most of the stuff you'd have when developing on iOS or Android directly (in-app billing, facebook etc.)
the final delivered package must be not too large
the engine can be free, but I also wouldn't mind paying a reasonable price
I've found the following engines:
Marmalade (and IwGame engine on top of it) - C++, found overall very positive reviews of Marmalade but not sure about IwGame. EDIT (March 2013): Looks like Marmalade SDK now includes Cocos2Dx and some in-built IDE which makes it much better (and costs $150 per year for indie dev which is ok with me).
Corona SDK - Lua (efficiency doubtful), also needs internet connection to compile code
Cocos2d-x - C++, received lots of reviews from developers, mostly positive and many think it's best for 2D
Particle code - Java+Eclipse, found no reviews or comments
Moai - Lua, coudn't find any reviews/opinions on it
Monkey engine - seems to have too few features
Haxenme - it's Flash, I've never used it and don't want to
use Unity3d but with 2D packages like 2D Toolkit
ports of SDL to Android (also here) and iOS - doesn't look to have much support or current development (?)
GLBasic - Basic language, I don't like it
playN - seems to be early in development (?)
Gamvas - HTML5, doesn't look like a mature engine to me
Ignifuga - Python, also doesn't look mature
ORX - not sure if it's still developed (?)
Construct 2 - reminds GameMaker, might be ok for rapid prototypes but definitely not for industry-level games
XNA and then port the game using ExEn (would need Mono Touch to port to iOS and Mono for Android to port to Android) - C#, and is probably more thought for folks coming from Microsoft products like xBox (I come from Android). Also, those Mono tools cost $800 in total for small developers
Impact - JavaScript, uses HTML5. I'm not much into JavaScript (e.g. preferred C# on Unity3d), also not sure about efficiency since it runs in the browser (?)
GameMaker - own scripting language GML and I actually remember this one as a tool for non-programmers. Has it actually grown into a real engine, I mean for serious development?
AppGameKit - C++, yet seems to be still pretty new. Haven't found any reviews on it
use Cocos2D and Objective C to develop for iOS only and then make an APK for Android out of it using Stella SDK. Has anyone done this? I'm pretty sure there will be limitations, and how about Google's in-app billing, AdMob and Facebook integration on Android?
Moscrif - JavaScript, looks like it's more for former web-developers
Starling - Flash 11, i'm not much into Flash
ND2D - not yet 1.0, does it have many features?
So, I'd be happy if you could comment from your experiences with the engines and suggest which one in the list (or anything else that I've missed) is the best for the described requirements. I also may be wrong with my first impressions about some of the engines.
I'm currently thinking of Marmalade+IwGame as the best option but since I don't have much info about Cocos2d-x and Particle code, I am not really sure about it.
Thank you!
EDIT (June 2013): So far I made 2 cross-platform 2D games and used Unity3D with 2D Toolkit plugin for both. For the game with simple GUI I used a simple self-made GUI system based on Unity's own. For more complex one (e.g. where GUI elements can overlap) I used the NGUI plugin. Recently 2D Toolkit added some more classes for GUI which is very handy since one had to use 2 different systems for texture atlases when combining NGUI with 2D Toolkit. I'll definitely try that one in the next 2D game. The main reason for choosing Unity3D for 2D games was that I already was deep into Unity3D both in terms of experience and accumulated code snippets for re-use. Also, I purchased Unity3D pro (with Android Pro and iOS Pro) for 3D games and it made full sense to just pay additional $60 for the 2D Toolkit to get 2D games also covered. I so far don't regret my decision, it seems to have been optimal for my case. The only thing which gave me headache was adding social features with the Prime31's plugins (Android & iOS social plugins) but I assume that their bugs are not the fault of Prime31 but of Twitter/Facebook instead, so I probably would see the same bugs on any other engine or plugin.
EDIT (Jan 2014): I guess with Unity 4.3 the answer to my question is pretty obvious now: the Unity's new sprites system and maybe also 2DToolkit totally beat anything else, especially for people who have (like me) been on Unity for a while and purchased the Pro version with add-ons.
LibGDX is one of the best engines I've ever used, works on almost all platforms, and performs twice as fast as cocos2d-x in most tests I've done. You can use any JVM language you like. Here's a 13 part tutorial in Java, and here's a bunch using jruby. There's a good skeletal animation tool that works with it here, and it has baked in support for tiled TMX maps as well. The ui framework is awesome, and it has a scene graph and actor style API similar to cocos2d scenes, sprites and actions. The community is awesome, updates are frequent, and the documentation is good. Don't let the java part scare you, it's fast, and you can use jruby or scala or whatever you like. I highly recommend it for 2d or 3d work, it supports both.
I've worked with Marmalade and I found it satisfying. Although it's not free and the developer community is also not large enough, but still you can handle most of the task using it's tutorials. (I'll write my tutorials once I got some times too).
IwGame is a good engine, developed by one of the Marmalade user. It's good for a basic game, but if you are looking for some serious advanced gaming stuff, you can also use Cocos2D-x with Marmalade. I've never used Cocos2D-x, but there's an Extension on Marmalade's Github.
Another good thing about Marmalade is it's EDK (Extension Development Kit), which lets you make an extension for whatever functionality you need which is available in native code, but not in Marmalade. I've used it to develop my own Customized Admob extension and a Facebook extension too.
Edit:
Marmalade now has it's own RAD(Rapid Application Development) tool just for 2D development, named as Marmalade Quick. Although the coding will be in Lua not in C++, but since it's built on top of C++ Marmalade, you can easily include a C++ library, and all other EDK extensions. Also the Cocos-2Dx and Box2D extensions are preincluded in the Quick. They recently launched it's Release version (It was in beta for 3-4 months). I think we you're really looking for only 2D development, you should give it a try.
Update:
Unity3D recently launched support for 2D games, which seems better than any other 2D game engine, due to it's GUI and Editor. Physics, sprite etc support is inbuilt. You can have a look on it.
Update 2
Marmalade is going to discontinue their SDK in favor of their in-house game production soon. So it won't be a wise decision to rely on that.
You mention Haxe/NME but you seem to instinctively dislike it. However, my experience with it has been very positive. Sure, the API is a reimplementation of the Flash API, but you're not limited to targeting Flash, you can also compile to HTML5 or native Windows, Mac, iOS and Android apps. Haxe is a pleasant, modern language similar to Java or C#.
If you're interested, I've written a bit about my experience using Haxe/NME: link
V-Play (v-play.net) is a cross-platform game engine based on Qt/QML with many useful V-Play QML game components for handling multiple display resolutions & aspect ratios, animations, particles, physics, multi-touch, gestures, path finding and more. API reference
The engine core is written in native C++, combined with the custom renderer, the games reach a solid performance of 60fps across all devices.
V-Play also comes with ready-to-use game templates for the most successful game genres like tower defense, platform games or puzzle games.
If you are curious about games made with V-Play, here is a quick selection of them:
Squaby: a tower defense game
Chicken Outbreak: a platformer like Doodle Jump
Blockoban: puzzle game
Crazy Elephant: a game similar to Angry Birds
Snowball Mania: multiplayer action game
Blitzkopf: brain game
(Disclaimer: I'm one of the guys behind V-Play)
Here is just a reply from Richard Pickup on LinkedIn to a similar question of mine:
I've used cocos 2dx marmalade and unity on both iOS and android. For
2d games cocos2dx is the way to go every time. Unity is just too much
overkill for 2d games and as already stated marmalade is just a thin
abstraction layer not really a game engine. You can even run cocos2d
on top of marmalade. My approach would be to use cocos2dx on iOS and
android then in future run cocosd2dx code on top of marmalade as an
easy way to port to bb10 and win phone 7
I find a nice and tidy Wave game engine few days ago. It uses C# and have Windows Phone and Windows Store converters as well which makes it a great replacement of XNA for me
and what about LibGDX from BadLogicGames?
Check out Loom (http://theengine.co) is a new cross platform 2D game engine featuring hot swapping code & assets on devices. This means that you can work in Photoshop on your assets, you can update your code, modify the UI of your app/game and then see the changes on your device(s) while the app is running.
Thinking to the other cross platform game engines I’ve heard of or even played with, the Loom Game Engine is by far the best in my oppinion with lots of great features. Most of the other similar game engines (Corona SDK, MOAI SDK, Gideros Mobile) are Lua based (with an odd syntax, at least for me). The Loom Game Engine uses LoomScripts, a scripting language inspired from ActionScript 3, with a couple of features borrowed from C#. If you ever developed in ActionScript 3, C# or Java, LoomScript will look familiar to you (and I’m more comfortable with this syntax than with Lua’s syntax).
The 1 year license for the Loom Game Engine costs $500, and I think it’s an affordable price for any indie game developer. Couple of weeks ago the offered a 1 year license for free too. After the license expires, you can still use Loom to create and deploy your own games, but you won’t get any further updates. The creators of Loom are very confident and they promised to constantly improve their baby making it worthwile to purchase another license.
Without further ado, here are Loom’s great features:
Cross platform (iOS, Android, OS X, Windows, Linux/Ubuntu)
Rails-inspired workflow lets you spend your time working with your game (one command to create a new project, and another command to run it)
Fast compiler
Live code and assets editing
Possibility to integrate third party libraries
Uses Cocos2DX for rendering
XML, JSON support
LML (markup language) and CSS for styling UI elements
UI library
Dependency injection
Unit test framework
Chipmunk physics
Seeing your changes live makes multidevice development easy
Small download size
Built for teams
You can find more videos about Loom here: http://www.youtube.com/user/LoomEngine?feature=watch
Check out this 4 part in-depth tutorial too: http://www.gamefromscratch.com/post/2013/02/28/A-closer-look-at-the-Loom-game-engine-Part-one-getting-started.aspx
I've tried AppGameKit, It's both c++ and Basic.
It's very easy to code 2d games in the Basic varient, with physics, collision and heaps more.
It's also in active development, and really cheap (65$).
The main problem is that it's really hard to compile for Android (you need to download heaps of files and follow difficult guides and things like that)
My opinion is that it isn't yet good enough for commercial use, but is good for indie programmers
It's got a medium size community
I currently use Corona for business applications with great success. As far as games go, I'm under the impression that it doesn't provide the performance that some of the other cross-platform development engines do. It is worth noting that Carlos (founder of Ansca Mobile/Corona SDK) has started another company on a competing engine; Lanica Platino Engine for Appcelerator Titanium. While I haven't worked with this personally, it does look promising. Keep in mind, however, that it comes with a $999/yr price tag.
All that said, I have been researching Moai for a little while now (since I am already familiar with Lua syntax) and it does seem promising. The fact that it can compile for multiple platforms, not limited to mobile environments, is appealing.
Multimedia Fusion 2 is also a worth contender, considering the complexity of games produced and the performance realized from them. Vincere Totus Astrum (http://gamesare.com) comes to mind.
Recently I used an AS3 engine: PushButton (now is dead, but it's still functional and you could use something else) to do this job. To make it works with Android and iOS, the project was compiled in AIR for both platforms and everything worked with no performance damage. Since Flash Builder is kinda expensive ($249), you could use FlashDevelop (there is some tutorials to compile in AIR with it).
Flash could be an option since is very easy to learn.

Categories

Resources