Soruces for simple OpenGL 2.0 HUD/GUI for android

device-2014-07-18-210940As I’m currently prototyping a new game for Android, I was in need of a quick (and simple) way of adding some selectable text elements on top of my 3D OpenGL ES scene. So I created a simple demonstration with full source (you can get them from my OpenGL ES git repository) that renders a 3D scene and a basic hud with clickable text elements on top of it in orthogonal mode.

The text elements are rendered to an OpenGL ES texture, using android’s canvas, making this a very flexible way of drawing text on top of an OpenGL ES scene. Note that this isn’t very fast, so the texture should only be updated when necessary. The demo has a menu along with a fps counter, so the texture will be updated every second, and the elements can be clicked and the hud’s observers will be notified with the clicked element’s id so you can easily react on user input.

Though this isn’t something you’d use in a production app where performance is crucial, it should be good start for rapid prototyping needs where you need to have some basic gui or hud to issue commands. And you’re always free to improve the sources (feel free to fork) to make it perform better, by e.g. only updating the areas of the texture where text changed, instead of updating every time if one of the elements is changed.

Soruces for simple OpenGL 2.0 HUD/GUI for android

Android OpenGL ES repository

device-2014-06-29-171344Following the C++ (OpenGL) repository, I recently added an Android OpenGL ES repositry (using Java) over here. It currently only contains two public demos, one for a simple stl viewer and another one for using the camera input of an android device as an OpenGL ES texture, but over time I plan on adding more and more demos.

And though I used to mock Java in the past I really like coding with Java nowadays. It’s partially because of the language itself (with all it’s modern features) but also because Eclipse is an awesome IDE. So expect more android demos and sources from me in the future.

Android OpenGL ES repository

OpenGL ES CapsViewer update to 0.2

ic_launcherI’ve just released an update for the OpenGL ES CapsViewer to google’s playstore. This version should fix crashes upon startup that seemed to be caused by a wrong egl configuration, so for this version I’ve changed the method of selecting the egl configuration for the render context.

So if the application crashed on your device feel free to update (in case you’ve turned automatic updates off) the the most recent version and submit your OpenGL ES reports.

There are already ~30 different devices present in the online database, and over the last few days I added some new features like comparing reports and more listings to the database.

Note that for certain devices (like this Samsung Galaxy Tab 2), the OpenGL ES CapsViewer will read OpenGL ES 1.1 (CM) as the supported OpenGL ES version, though it should actually support OpenGL ES 2.0. Since I don’t have such a device it’s hard to test why it only reports OpenGL ES 1.1.

OpenGL ES CapsViewer update to 0.2

OpenGL ES Caps Viewer available on Playstore

My first ever mobile app is now available over at Google’s PlayStore! This is a premiere for me, and though I wasn’t on wether to spend the 25$ registration fee for the google’s developer console, I hope many android apps and games will follow.

device-2014-02-02-202348 device-2014-02-02-202410 device-2014-02-02-202423  device-2014-02-02-202459

[appbox googleplay de.saschawillems.glescapsviewer]

The OpenGL ES CapsViewer is the mobile counterpart to the OpenGL CapsViewer, reading the OpenGL ES implementation info of your Android device, as well as device information that may be of use to developers. As with the desktop counterpart these reports can then be submitted to the online database, where (game) developers interested in creating OpenGL ES apps for the android platform can take a look at the capabilities of the different devices.

It currently supports the following features :

  • Basic device information (Name, CPU, screensize)
  • Hardware sensors (including their range and resolution)
  • OpenGL ES implementation information
  • OpenGL ES extensions
  • OpenGL ES compressed texture formats, shader and program binary formats
  • OpenGL ES caps for 1.0, 2.0 and 3.0
  • EGL implementation information

As for the hardware requirements, it should work with Android 3.0 (and up) and needs OpenGL ES 1.0 to work. I’m not that deep into android development, so I may be  a bit off with the requirements, and I’m not certain on wether there’s any use in adding support for handsets with old Android version (2.x and below).

Please note that this is the first release, and that I only have limited ways of testing. I did tests on several mobile devices (my Huawei Ascend G510, differnt current Samsung devices and several emulators), so this first release may not be as stable as I want it to be 😉

So if you encounter any problems or crashes, please drop me a line and I’ll look into it. Also note that that online database is a work-in-progress too, and stuff like comparing reports will be added at a later point.

I hope this Android OpenGL ES hardware database will become as valuable to the developer community as the desktop OpenGL hardware database, which is currently approaching 500 hardware reports. So let me use this posting as a way of thanking all of you that contributed (and still contribute) to that database!

OpenGL ES Caps Viewer available on Playstore

OpenGL ES Hardware Database Preview

It took (a bit) longer than expected, but I finally got the first preview of the online OpenGL ES Hardware Database online. I want this to be the match to the widely used OpenGL Hardware Database (filled by the glCapsViewer). Where the former is aimed at developing desktop applications with OpenGL, the later one is planned to be a helper for all developers planning on deploying OpenGL ES based applications, games or tools on the Android platform (other platforms that support OpenGL ES may follow in the future, the database design is flexible enough) that want to know what features are offered by the different devices on the market.

In addition to the pure OpenGL ES related information, like extensions, caps, texture formats etc. the database will also store device information (OS version, screen size, CPU), device features and available sensors along with their range and resolution. Especially the sensor information should proove valuable in case you want to wether your targeted devices support e.g. a gyroscopic sensor or not. The database is targeted around OpenGL ES 2.0 and above, as that’s the majority of devices currently out there.

The database is still a work in progress and several new features will be added over the coming days and weeks (like comparing reports), but any feedback on how to improve it or what features to add is welcome.

The android app will be release in the near future. It’s currently in alpha testing stage, but seems to run fine on a wide range of devices (at least the ones you see in the database 😉 ). No date yet on when it’ll make it’s way into the public, but since it’s running stable and everything is in place it shouldn’t be too far in the future.

As for the technical backgrounds :
The android app is written in JAVA (yes, I actually like working with a modern language and IDE, something Delphi has been lacking in the recent years) using Eclipse. I had it up and running with the new Android Developer Studio, but since that one is still a preview version I’ll stick with Eclipse for now. Though google’s developer studio seems to come along very nice.
I also made the switch from SVN to GIT with this project, and I’m pretty amazed by all the features that GIT has to offer and how much better suited it is for agile developement. Sure, the tools (especially on windows) are not as convenient as the ones for SVN, but the easy branching, rebasing and stashing stuff easily makes up for that.
The database uses MySQL, and I’ve used the free MySQL workbench to set it up (which is so much better then working with phpMyAdmin). Since I’ve gathered a lot of experience with (SQL) databases due to my current job, the database design for the OpenGL ES database is much better than the one backing up the old OpenGL database. So instead of letting a PHP script import the report’s xml into the database, it’s now done via a stored procedure using XPATH. Not only easier for me to maintain and extend, but also much faster.
And on the other hand the database design is also much more flexible, and adding new stuff and OpenGL ES versions (along with new caps) should be much easier. And you may also notice that the content is provided under a creative commons license.

But once the OpenGL ES database and it’s android app are out in the wild, I’ll get back to the OpenGL database to see what I can do in terms of performance and what features I can add to make it even more valuable to the OpenGL developer community.

OpenGL ES Hardware Database Preview

New target : Android

I’ve been using a symbian “smartphone” (a Samsung SGH-i560) for ages now, but finally decided to swap it for a new and shiny Android device, mainly to code on.
So I recently bought myself a Huawei Ascend G510. It’s a middle class Android handset with a dual-core CPU (1,2GHz) and a 4.5″ screen that supports OpenGL ES 2.0 that doesn’t cost a fortune (~140€) and condidering the pricetag it’s a pretty good phone.
So once the battery was loaded I attached it to my PC and started to develop on it right away. I started off with the native FPC armv7-cross compiler using native Android Controls, went over to integrating Free Pascal (JVM) into Eclipse and did some basic OpenGL ES demos with both of them.

And though it may be appealing to code in pascal for the Android platform, I decided to go with Eclipse and Java. Java has a lot in common with Delphi, and getting used to it’s syntax only took me a few days and I’m already creating productive sources. Actually I kinda like coding with Java (and Eclipse). You get lots of modern language features that Delphi has been lacking for years, and the code features (auto completion, correcting problems, etc.) are just great. And best of all is that you get it for free, which is no comparsion to the expensive entry into the Android world with Delphi XE5 (which btw. forces you to use FireMonkey).

So after getting used to Java and Eclipse (in the form of ADT) I started work on an Android version of the glCapsViewer, called “glESCapsViewer”. It’s already up and running, getting the implementation details. It reads out information on the device, the renderer, all available extensions and all supported texture compression formats. Next on the line is generating XML files for the repots and then uploading them to my online database.

I’m not sure yet on wether to just add the mobile OpenGL ES reports to the current caps database, or to add a sparate database. But I guess I’ll go for the latter way, as it’ll allow for more flexibility. This would allow me to e.g. also add information on the device iteself and wouldn’t inflate the desktop report database with OpenGL ES versions and extensions.

It’s not quite ready yet, but expect an Android version of the glCapsViwer in the near future. And also expect to read lots of postings on Android and Java. Once the glESCapsViewer ist done, I plan on creating my first mobile game, and it may be a port of Trugbild, as the gameplay itself is perfect for touch based devices. I’m even thinking about using the motion sensors to move along the scenery 😉

New target : Android