Site Updates, and Thoughts on Native Development for the Web

I’ve recently been spending time travelling overseas, taking a bit of a break after reaching an important milestone with the book, and also taking a bit of a rest from working for myself! The trip has been good so far, and I’ve even been keeping up to date with items from the RSS feed. Here is some of the news that I wanted to share with y’all, as well as to get your thoughts:

Book nearing production

OpenGL ES for Android: A Quick-Start Guide reached its final beta a couple of weeks ago, and is now being readied to be sent off to the printers. I would like to thank everyone again for their feedback and support; I am so grateful for it, and happy that the book is now going out the door. I’d also like to give a special thanks to Mario Zechner, the creator behind libgdx and Beginning Android Games, for generously contributing his foreword and a lot of valuable feedback!

Site news

Not too long ago, I decided to add a new forums section to the site to hopefully build up some more community involvement and get a two-way dialogue going; unfortunately, things didn’t quite take off. The forums have also suffered from spam and some technical issues, and recently I was even locked out of the forum administration. I have no idea what happened or how to fix it, so since the posting rate was low, I am just putting the forums on ice for now.

I’d still love to find a way to have some more discussions happening on the site. In which other ways do you believe that I could improve the site so that I could encourage this? I’d love to hear your thoughts.

Topics to explore further

I’ve also been thinking about new topics to explore and write about, as a lot of exciting things are happening with 3D on the mobile and web. One big trend that seems to be taking place: Native is making a comeback.

For many years,  C and C++ were proclaimed to be dead languages, lingering around only for legacy reasons, and soon to be replaced by the glorious world of managed languages. Having started out my own development career in Java, I can agree that the Java world does have a lot of advantages. The language is easier to learn than a behemoth like C++, and, at least on the desktop, the performance on the JVM can even come close to rivalling native languages.

So, why the resurgence in C and C++? Here are some of my thoughts:

  • The world is not just limited to the desktop anymore, and there are more important platforms to target than ever before. C and C++ excel at cross-platform portability, as just about every platform has a C/C++ compiler. By contrast, the JVM and .NET runtimes are limited to certain platforms, and Android’s Dalvik VM is not as good as the JVM in producing fast, efficient JIT compiled code. Yes, there are bytecode translators and commercial alternatives such as Xamarin’s Mono platforms for mobile, but this comes with its own set of disadvantages.
  • Resource usage can be more important than programmer productivity. This is true in big, expensive data centers, and it’s also true on mobile, where smaller downloads and lower battery usage can lead to happier customers.
  • C and C++ are still king when it comes to fast, efficient compiled code that can be compiled almost anywhere. Other native would-be competitors lose out because they are either not as fast or not as widely available on the different platforms. When productivity becomes more important than performance, these alternatives also get squeezed out by the managed and scripting languages.

As much as C and C++ excel at the things they’re good at, they also come with a lot of legacy cruft. C++ is a huge language, and it gets larger with each new standard. On the other hand, at least the compilers give you some freedom. Don’t want to use the STL? Roll out your own custom containers. Don’t want the cost/limitations of exception handling and RTTI? Compile with -fno-exceptions and -fno-rtti. Undefined behavior is another nasty issue which can rear its head, though compilers like Clang now feature additional tools to help catch and fix these errors. With data-oriented design and sensible error handling, C++ code can be both fast and maintainable.

Compiling C and C++ to the web

With tools like emscripten, you can now compile your C/C++ code to JavaScript and run it in a browser, and if you use the asm.js subset, it can actually run with very good performance, enough to run a modern 3D game using JavaScript and WebGL. I’ve always been skeptical of the whole “JavaScript everywhere” meme, because how can the web truly become an open computing platform by forcing the use of one language for everything? There’s no way a single language can be equally suitable for all tasks, and why would I want to develop a second code base just for the web? For this reason, I used to believe that Google’s Native Client held more promise, since it can run native code with almost no speed loss. Why use JavaScript when you can just execute directly on the CPU and bring your existing code over?

Now I see things a bit differently and I think that the asm.js approach has a lot of merit to it. NaCl has been around for years now, and it still only runs in Google Chrome, and then only on certain platforms and only if the software is distributed through the Chrome store, or if the user enables a developer flag. The asm.js approach, on the other end, can run on every browser that supports modern JavaScript. This approach is also portable, meaning it will work into the foreseeable future, even on new device architectures. NaCl, on the other hand, is limited to what was compiled. Portable NaCl is supposed to fix this, but it’s been a work-in-progress for years now, and given the experience with NaCl, it may never find its way to another browser besides Google Chrome. Combined with WebGL, compiling to JavaScript really opens up the web to a lot of new possibilities, one where you can deploy across the web without being tied to a single browser or plugin. The BananaBread demo shows just some of what is possible.

I’d like to learn more about writing OpenGL apps that can run on Android, iOS, and the web, all with a single code base in C++. I know that this is also possible with Java by using Google’s Web Toolkit and bytecode translators (after all, this is how libgdx does it), but I’d like to learn something different, outside of the Java sphere. Is this something that you guys would be interested in reading more of? This is all relatively new to me and I’m currently exploring, so as always, looking forward to your feedback. 🙂

Update: I am now developing an air hockey project here: Developing a Simple Game of Air Hockey Using C++ and OpenGL ES 2 for Android, iOS, and the Web

Introducing GLWallpaperService

Are you looking to make a live wallpaper for Android? Wondering how to use OpenGL from a wallpaper service?

Mark Guerra and some other contributors have kindly made their work available on GitHub, at This repository includes an OpenGL wallpaper service as well as several samples that show you how to use the service.

Yours truly has submitted a couple of pull requests to add support for OpenGL ES 2.o and to provide an alternative implementation which minimally wraps GLSurfaceView. If / when these are merged in, I’ll be able to update How to Use OpenGL ES 2 in an Android Live Wallpaper, as it’ll become much easier to do so!


Announcing the New Forums, and a Roundup!

Starting from today, Learn OpenGL ES now has a new community section of the site with a new set of forums! [Edit: Due to some technical issues and low usage, I have disabled the forums until further notice. I would still like to have a forums section in the future, so they can come back if the comments section proves to be inadequate. Thanks!] I’ve also switched themes, so please let me know if you find any issues, have feedback or miss anything from the old theme!

On to the roundup:

I’m also happy to announce that in the spirit of sharing with the community, all of the content on this site is now licensed under the Creative Commons CC-BY-SA 3.0 license. Please feel free to reuse and share in the spirit of CC-BY-SA 3.0.

Introducing OpenGL ES for Android: A Quick-Start Guide, Now in Beta

OpenGL ES for Android: A Quick-Start GuideHi all,

After nearly a year of working with the great team over at The Pragmatic Bookshelf, I am happy to announce that OpenGL ES for Android: A Quick-Start Guide is now in beta!

OpenGL ES for Android: A Quick-Start Guide follows in the tradition of this website and goes into more detail, teaching you how to create your first OpenGL project from scratch. You’ll learn about shaders, the OpenGL pipeline, and discover the power of OpenGL ES 2.0.  If you want to learn more about OpenGL for Android and you have a creative vision that you’d like to share with the world, then this is the book for you.

I would like to invite you, dear reader, to come check out the book and participate in the beta. As a beta book, the book is almost finished, with just a few rough edges and a couple of chapters to go, and a few things that need to be worked on. I could benefit greatly from your suggestions and feedback!

I hope that the book proves useful to you, and thanks for your continued support. 🙂

OpenGL Community Roundup, January 2013 Edition

Welcome to another community round-up! A lot of people have been busy, creating great games, tutorials, and live wallpapers. Check them out below (in alphabetical order):

Advancing Usability



Rene van der Lende

  • Kube — a tutorial on rotating a cube using OpenGL for Android.

Teaching Machines

Team Blubee

If I forgot someone or something, just let me know! I hope you all enjoyed the holidays, and I look forward to a great 2013, with more great stuff coming from the community. 🙂

Check Out These Cool Live Wallpapers, Games, and Tutorials by Fellow Learn OpenGL ESers!

The community has been busy here at Learn OpenGL ES, as many visitors have been developing fantastic games, live wallpapers, and tutorials of their own! I’d like to highlight some of the work that I have come across in recent weeks; if you’re part of the community here and would like to be featured as well, please give me a shout-out via the contact form!

Spiral Maze!

Spiral Maze!Buggies! - Live Wallpaper

Spiral Maze! is a fun and addictive little game by Prodigen, with physics implemented with JBox2D. Prodigen is also behind the highly ranked and regarded Buggies! – Live Wallpaper, as well as AppShaker. All are definitely worth checking out!


Paperland Live WallpaperExodus Live WallpaperLight Grid Live Wallpaper

Then there’s Joko Interactive, the developer behind the incredibly beautiful and attractive Paperland Live WallpaperLight Grid Live WallpaperExodus Live Wallpaper, and many more!


I’d also like to give props to fellow community members Sankar and bluBee!

Sankar has been sharing his own work and tutorials here:

bluBee has been sharing his own work and tutorials here:

Thanks for giving back to the community!

If you’re part of the community and would like to be featured as well, please let me know via the contact form!

Enhanced by Zemanta

Check out These Cool Apps from an Early Student of Learn OpenGL ES!

An early student of Learn OpenGL ES, Miguel, has been working on some neat apps lately. Miguel was one of the first readers at Learn OpenGL ES, and we’ve exchanged at least a few emails back and forth about different topics, such as working with the camera through matrices. We were both learning a lot back then, and that sort of interaction really helped to strengthen my own personal knowledge of OpenGL.

Miguel hasn’t stopped learning, and he recently sent me over a link to his live wallpaper, “Shark 3D Kosmos”. I’m really happy with the progress he’s made so far; read on to learn more!

Shark 3D Kosmos Live Wallpaper

This wallpaper features a scary and realistic shark swimming on your home screen! The shark can be rendered in different modes, including holo mode, and you can select from several different camera modes, including one where the shark swims straight at you! The live wallpaper even includes features to save battery usage.


Kosmos Galaxy 3D

This is a neat dynamic simulation of the attraction between the center of a galaxy and its surrounding stars. You can move the simulation around and add galaxies in realtime.


I’m happy with how far Miguel has come since the first lessons here at Learn OpenGL ES. If you’ve also learned from the site and would like to showcase your work, let me know!

Android Emulator Now Supports Native OpenGL ES2.0!

For those of you who may have missed it, the Android team recently released an upgraded emulator image that has support for native OpenGL ES 2.0! That’s right; not only is it now supported, but the calls are translated to desktop OpenGL so they can be accelerated by your native graphics layer. It’s still better to test on an actual device, but this is a great boon for those who want to try out their app on different form factors without having to go out and buy a bunch of tablets and devices.

Check out the video:

Three notes about the GPU emulation

  1. First, you need to edit your emulator image, go down to the hardware section, and add “GPU Emulation” and set it to true.
  2. Second, there’s a bug with the emulator such that this line: “final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0×20000;” does not work. It will always return false. You can add “|| Build.FINGERPRINT.startsWith(“generic”)” or simply comment out these checks and assume that OpenGL ES 2 is supported, when running on the emulator.
  3. Finally, if it crashes with “no config found”, try adding this line before the call to “setRenderer(…)”: “glSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);”

A quick roundup

Hope that everyone is enjoying the gradually improving weather out there.

OpenGL ES Roundup, March 9, 2012

Thank yous and mentions

A big thank you goes to the following guys who have recently kindly featured Learn OpenGL ES:

Thanks again; you all have my deepest gratitude!

State of WebGL on Android

The following browsers now support WebGL on Android:

Using Vertex Buffer Objects on Froyo (Android 2.2, SDK 8)

Bindings can be downloaded from here:

I cover how to use these bindings in Android Lesson Seven: An Introduction to Vertex Buffer Objects (VBOs). Note: These bindings are NOT needed if you don’t mind excluding a quarter of the market (as of the time of this writing) and target Gingerbread and higher.

The new iPad

In non-Android related news, Apple just released the third generation iPad, known as the “new iPad”, with a 2048×1536 “retina display”. Here are the specs:

Apple A5 SoC (system on a chip):

Judging by initial benchmarks, this thing just screams. iOS had never had the “Android lag” problem seen so often on Android phones and tablets, and this new tablet will only continue that trend. To be fair, throw enough hardware at the problem and maybe even Android will become lag-free.

What are your thoughts on the new iPad? Interested in picking it up? I love competition, because the more Apple, Android, and Microsoft duke it out, the better it is for us consumers! So long as nobody ends up dominating the market.

Have a good weekend, all!

Enhanced by Zemanta

Google Celebrates 10 Billion Downloads on the Market: Several Great Apps Available for Only 10 Cents Each!

Android Market
Image via Wikipedia

Android is booming very rapidly, and the market share has gone from nothing to dominating the market, within only a couple of years. I still remember when just a bit more than a year ago, competitors still thought that Android was only going to fill a niche market, and that it was “clunky” and “slow”. Well, its open nature has led to a rapid explosion of devices with Android, and rapidly improving speeds are getting rid of the Android “lag”.

From the Android Developer’s Blog:

The Android Market has recently crossed 10 billion downloads, and Google is celebrating:
“One billion is a pretty big number by any measurement. However, when it’s describing the speed at which something is growing, it’s simply amazing. This past weekend, thanks to Android users around the world, Android Market exceeded 10 billion app downloads—with a growth rate of one billion app downloads per month. We can’t wait to see where this accelerating growth takes us in 2012.”

“To celebrate this milestone, we partnered with some of the Android developers who contributed to this milestone to make a bunch of great Android apps available at an amazing price. Starting today for the next 10 days, we’ll have a new set of awesome apps available each day for only 10 cents each. Today, we are starting with Asphalt 6 HDColor & Draw for KidsEndomondo Sports Tracker ProFieldrunners HDGreat Little War GameMinecraftPaper CameraSketchbook MobileSoundhound Infinity and Swiftkey X.”

For 10 cents, why not try out a couple of apps? It’s amazing to see just how the quality of apps has improved over the past year, especially games. Unfortunately my Nexus S did reboot while playing one of the games, so the stability still isn’t all there, but I definitely do see an improvement in quality as compared to last year.

Check out the post for more details. It sounds like there will be a new set of apps at 10 cents each day!

Note: If you don’t see the apps at 10 cents on your phone, try going to the Android Market from your PC, instead. I had the same issue, where the app was listed at $4.99 on my phone and at 10 cents on the web. If you have a Google account linked to your phone, then you can just purchase from the web and Google will automatically send the app to your phone.

Enhanced by Zemanta