I've been given a task of designing an app in android with the UI created in OpenGL. The reason for this approach is the fact that the app will be a port from iPhone and Android does not have such smooth animations and graphics as IOS.
I have experience in Android development but I'm totaly new to OpenGL.
Is that approach reasonable to create GUI in OpenGL? If not, why? If yes, how do I start?
Is your application a game? because if not, I think using OpenGl just for creating a fancy UI might be too much. It leaves the door open to do things inefficiently, and probably, get a lot of bugs.
You can get a lot fo smootth animations using the different animations of Android.
If you still want to go with OpenGl, I will first advice you to start with Android Documentation
Related
I created Android live wallpaper using canvas but it seems to be quite slow in performance. I was thinking of shifting towards OpenGLES 2.0 but it is very difficult to code from scratch because there are a lot of animations. I want a sincere opinion which one is the best for making live wallpapers Unity or OpenGLES 2.0, also give a basic idea whether unity slows down the wallpaper or not.
Thanks in advance.
I'd suggest using Unity.
Unity engine is pretty good for highly-visual stuff, with its visual editor, good asset import pipeline and tons of stuff on Asset Store that would help to boost your development. It'd be very hard to beat it performance-wise. There are other game engines that you could use for live wallpapers, but it'd be a much more tedious task.
The negative side of using Unity is that it might be somewhat heavy - it's expected to have an minimal APK of around 9 MB in size This doesn't really matters if you have a resource-heavy live wallpaper, though.
What makes it possible, is that recently I've released uLiveWallpaper - a Unity asset that makes it possible to create live wallpapers for Android using Unity 5. It is well-tested and reliable, creates projects for Android Studio, complete with placeholder code to get you started.
Check it out:
http://forum.unity3d.com/threads/ulivewallpaper-develop-android-live-wallpapers-with-unity-5.375255/
I don't think you can create a live wallpaper using Unity. At least not easily, Unity is not intended for this. Usually a live wallpaper consists of a service, a Settings activity, and some sort of resource which defines your live wallpaper. Everything you create in Unity will be compiled packaged magically transformed into an activity with a launcher. This means your Unity "game" will not be in the wallpapers list, but in the apps list. Also, by default it will run in the front, not in the back of a home screen like a live wallpaper would do.
To make it work as a wallpaper would require a lot of altering to what Unity outputs when building, because Unity does not offer any live wallpaper settings. That seems like a lot of work. Also, it seems a bit overkill to use a game engine or OpenGL for a live wallpaper.
Keep in mind that you should not try to create a >30 fps live wallpaper, because that would drain an Android device's battery pretty fast. If I were you I would try to make the wallpaper look good with <30 fps. Try not to have fast animations, pre-render 3D stuff and optimize what you already have.
I am planning to do an app that involves triangle colliding with circle. Also determining how fast the user touches the circle while it is is moving.
I am already experienced with android development (but limited on drawing but knows the basic). Should I go with surface view drawing or should I start learning libgdx for the above purpose? And what would be the rational "so it is not vague/opinionated question"
Thank you so much
I suggest you to go with libgdx. It is very well designed, well documented and has a friendly community which will help you to quickly get started.
Furthermore it will be a lot easier to render graphics elements, which would be a lot more difficult with "pure" Android/OpenGL.
Another great feature you might be interested in is that libgdx has a Box2D extension, which might help you with the triangle/sphere collisions, if you are planning something more advanced here.
And last but not least libgdx would be my preferred way of developing a game, because I can develop it on desktop and then just deploy and test it on my mobile device.
Can I Use both Adobe Flash cs5 and OpenGL to create an application on an android OS4.3 device?
I am creating a 3D chess game compatible for an android OS 4.3, so I am using eclipse and the SDK obviously.
The problem I have now is I am meant to make the chess pieces human like. For instance, the pawn pieces should look like miniature foot soldiers and the king piece should be a figure of a person sitting on a throne etc. I started with OpenGL but because I am new to it, I might not be able to carry put displaying the graphics with OpenGL. So I decided to use adobe flash cs5 to create the pieces and use OpenGL to make the chess board because I can do that and also because in my specs, I said I would be using OpenGL.
I want to know if this will actually work and also if there is a much easier way of doing this I just haven't thought of. Any suggestions would be appreciated, especially how to implement this with the A.I.
If anyone has a sample or an idea I could work with, I will also be very grateful.
Adobe has said that "Stage 3D" support will be coming to mobile devices in the future, but in the meantime, there are not any ways to accelerate 3D with Adobe AIR.
Although Away3D or another 2.5D library would be fast enough for the web or desktop, I am not sure how well this will work for mobile, as AIR moves slow enough even for 2D games.
Since chess is a relatively static game, you might be able to create 3D graphics, then render to 2D sprites. I was the lead engineer for a large Facebook game, and we used this approach. ALthough it required more file size, it worked very well for quality and performance. The end result was something similar to Diablo 1, but in a cowboy theme instead of medieval.
Although it does not have true 3D support, yet, you might also consider looking into NME. That Facebook game I made ran at 5-6 FPS using Flash, but topped 30 FPS using NME on my old Palm Pre (so not the fastest phone in the world). That might help give you extra overhead to be able to lean into rich graphics. The framework will also publish as a true C++ NDK application, so it is actually possible to extend or modify the framework (it's open source) with your own OpenGL calls.
Here's the website if you're interested: http://www.haxenme.org
I am a fairly "newb" Android developer, and I would like one of my first projects to be a live wallpaper, however I am conflicted on whether I should be focusing on Canvas or OpenGL for it. Being new to this I know I should master Canvas first since it is easier to use, but I prefer to learn from real world projects that I have an interest in, even if it's a little backwards at times.
I have used both before in very basic ways, and I understand the general concepts to them, but I am not sure how they transfer over to the realm of live wallpapers. I figure that the full blown speed of OpenGL isn't required on a live wallpaper, since running it at max FPS would just run down the battery more than it necessary, but at the same time I am worried that using Canvas would cause lags and stutters when doing things like changing home screens.
I have been leaning towards using OpenGL ES 2.0, both to keep performance optimal and because my initial ideas for the wallpaper involve a lot of layering that I am not sure Canvas is capable of, but I'd like a more experienced developers opinion on whether or not all of the extra work involved in using OpenGL (especially in relation to live wallpapers, from what I've read) is worth it.
If you can get away with just drawing to a canvas (e.g. cube example in SDK), that's much less work. Because of the simplicity of the animation (no bitmaps), the cube is able to achieve a high frame rate without difficulty.
If you want to use OpenGL, you will need to use a supplemental package, such as GLWallpaperService, AndEngine, or RenderScript.
http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers
http://www.andengine.org/forums/tutorials/live-wallpaper-template-t258.html
Browse the Android source code to see how the stock wallpapers (e.g. Grass, Galaxy) are implemented using RenderScript. This link may work, but no guarantees: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/wallpaper/ (then scroll down to the wallpapers)
Moonblink has discontinued his project, but if you're really keen, you can try researching his work (Substrate) starting here: http://code.google.com/p/moonblink/source/browse/wiki/Setup.wiki
I ended up using OpenGL as halfway through the project, canvas drawing proved to be too slow for what I was trying to achieve. Using OpenGL caused a massive performance boost. Unfortunately I had to refactor my code, so I would reccomend using OpenGL from the start. Dirty rendering is supported by OpenGL as well as the wallpaperservice's structure doesn't rely on the way you render things so you would still be able to create a wallpaper that doesn't drain the battery. Actually a well programmed wallpaper doesn't render when it's hidden. As the wallpapers shipped with android don't follow that pattern, live wallpapers now have the bad name of being battery suckers. Really a shame..
I want to create a simulation game and a main component of this simulation will be a 2D map (topographical/navigation map), which shall have different layers (objects are moving on the map, using of labels, you get it)
The question for me is now, shall I use OpenGL to accomplish this or is that not necessary? I have no special requirements apart of that the scrolling and zooming shall be smooth. The target platform are only Android tablets (so Android OS 3.0+).
Edit: To precise my question:
platform independence is not important for me
I'd like to go with the easiest way concerning implementation efforts
If and only if you're really targeting Honeycomb specifically, then don't bother with OpenGL... and I say that as a reasonably experienced OpenGL programmer who's done some cool things with it on Android.
My reasoning is that, starting with Honeycomb, the normal Canvas-based APIs are hardware-accelerated too. Typically the only real reason for using OpenGL was greatly increaased performance, but that is no longer the case.
Or so the theory goes... I've yet to see actual Honeycomb hardware and run comparative tests. What I do know is that the Honeycomb emulator shows triangular tearing everywhere, strongly suggesting the whole desktop is now going through the GL pipeline.
If you have solid experience with OpenGL go with it. If not try some performance tests before you really decide if you invest time to learn it or if you use the good old simple 2D canvas drawing...
I'm not an expert on OpenGL + android (or any other mobile devices), but I think you will get better results (more FPSs, better drawing and animation options, etc) using OpenGL.
If you're used to non-OpenGL android development and are new to OpenGL it would be easier develop the game without using OpenGL. But before you choose this option, be aware that it should be a better option to use OpenGL if you aim to achieve beautiful/good performance graphics!
In short, if you master "regular" android development and prefer to build something good enough in a short time, stay "regular". Otherwise, I advice you to go for OpenGL.