Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am referring to the using of c++ code in strings in this official android training post. Why hasn't google eliminated all need for native languages inside it's ' java world '?
Link:http://developer.android.com/training/graphics/opengl/draw.html
Under "draw a shape".
Thanks in advance for satisfying my curiosity.
Also, this may be a stupid question, and if so, please say so kindly while still giving me an answer.
The GLES20 class provides you Java wrapper methods, so you are not really using C++ yourself. Under the hood, Android uses JNI to bind these Java wrapper methods to their corresponding C/C++ implementation.
If you are referring to the shaders, it is not C++ what is being used. OpenGL ES 2.0 provides more flexibility by allowing you to specify how the pipeline should draw each vertex and fragment. It does so by using the OpenGL Shading Language which is what is shown on the docs.
Because C and C++ are at a minimum 30% faster than Java code, and often even better. If you want high performance (and base 3d graphics libraries need high performance), you need to use C.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to draw an image pixel by pixel to do some effects, but I nned to do that in a very effecient way. I heared that I can use c++ to make this task faster in android...Would you please help me how to do this in a very effecient manner.
Maybe,you can try OpenCv.
OpenCV is released under a BSD license and hence it’s free for both academic and commercial use. It has C++, C, Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and Android. OpenCV was designed for computational efficiency and with a strong focus on real-time applications. Written in optimized C/C++, the library can take advantage of multi-core processing.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm relatively new to Android (about 1 year experience on standard apps), and I have a great idea for a small 2D Game.
My question is : Should I code it in native code only (using shapes, listeners, backgrounds, or some components I don't even know) or is there a library to use that will ease the development and/or improve user experience ?
This game will not be an advanced 2D game, but more "CandyCrush-like" little games.
If you come up with some nice libraries or SDK to use, please note that portability to other platforms is very important.
Thanks!
I'd strongly suggest to use a game engine, even for a simple game such as a CandyCrush-like.
It will save you a lot of effort for basic things which are common to all games and quite long to properly implement (such as game loop management, sprite animations,...). Most of them are based on OpenGL ES which is quite a nightmare to program manually but provides great performance.
Then you should decide which language you're most familiar with (C++, Java, Javascript, Lua, Ruby, whatever...): it will improve your learning curve.
Choosing a cross-platform game engine might also be a good idea (porting a native game is a huge work).
Take a look at those:
cocos2d-x (C++)
corona SDK
Unity
...
Note that this discussion would be more relevant on https://gamedev.stackexchange.com/ (and you might get better answers too).
If your game is really simple, you can try developing with either
Android Canvas or
OpenGL ES
Especially for developers that are not that experienced, who want to develop simple games, the Canvas is a good option in combination with a SurfaceView. Alternatively, I can recommend this engine:
AndEngine
or
Unity Engine with 2D extension could also be a good option.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am new to android development and I plan to make a 2d game engine but I don't really know where to start. I read something on the internet but I don't find any good opengl es documentation for android, I don't even know where to start.
If you have no idea where to start, I will point you to the excellent book Beginning Android Games. If you are serious about this, then it is more than worth the investment.
This is a beginner/intermediate text, but in the book the authors (Mario Zechner & Robert Green) create a fairly decent game development framework - not exactly a fully blown engine but it is highly reusable and easily expandable and, unless you've created a game engine before, I would advise you to walk before you try running. Creating a game engine is very complicated so start off with something that you will be able to finish and use, then once you've got that down you will have the confidence you need to build your own.
For me this book was the perfect introduction to android development - I had a great deal of programming experience but mostly in C/C++ with DirectX, some basic OpenGL, and software rendering and had no knowledge of Android, Java, or OpenGL ES. With this text I was up and running in a very short period and got some games done, which is always a great boost to keep going :)
COCOS2d is an open source framework for android and iphone and you will also found good tutorial for this framework. Find here
cocos2d-android
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
independent from the fact if it makes sense or not, if it is a good way to create Android apps or not: for (educational/personal/whatever) reasons I want to create an Android app with graphical user interface in C++ using the NDK.
What I found so far are some information about the NDK, how to create native libraries and how to access them out of Java applications. But what I'm really looking for are some information how to create a View and to add graphical user interface elements to that View out of my C++ NDK app.
Any ideas and hints how that can be done or where some more information/HOWTOs can be found regarding this?
Juce is a fantastic C++ UI framework that works well on Android.
It can be used under the GPL or a paid-for commercial licence. The community is fairly active and the author is very friendly and helpful. I found it relatively easy to build using the NDK tools on Windows.
Caveat - it seems Android isn't a high priority platform for them, so some things are missing at time of writing (e.g. support for hardware buttons). Still, in my experience, the UI framework does work very well on Android, and that's what your question is about.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've just started to develop games on Android. My first game is a 2D game and I'm wondering whether I should use OpenGL or not.
Does anyone have some advice on this?
Thanks a lot,
Viet
OpenGL ES all the way! There are some good videos from last years IO on android game dev and the frame rates you can achieve going opengl vs canvas.
http://www.youtube.com/watch?v=7-62tRHLcHk&feature=player_embedded
http://www.youtube.com/watch?v=U4Bk5rmIpic
Also there are a handful of great 2d frameworks to simplify the process, the best in my opinion being AndEngine
As far as I know OpenGL ES will give better performance (especially on Tegra 2 devices). OpenGL ES is also harder to learn, but there are good tutorials and support libraries.
I recommend you not to use OpenGL directly as it may seem difficult. Instead you can use a library like LIBGDX which provides easier functionality.
Check this tutorial:
http://m3ph1st0s.blogspot.ro/2012/12/create-games-with-libgdx-library-in.html
You will want to use OpenGL ES if you want anything close to a respectable frame rate. OpenGL ES is hardware accelerated (uses the GPU), while other libraries mostly use the CPU.