How To Get Android OpenGL 1.0 and 2.0 Information and Constrains – Revisited

Some time ago I’ve made a short post (here) about the basics of how to get opengl infos on an android device. For an app I’m currently working on it was required to get all interesting information once more in my android device information application. The basic idea is to add a respective opengl 1.1 or opengl 2.0 and possibly even opengl 3.0+ context to the active view, load all information in the onSurfaceCreate method of the renderer and remove the view afterwards again.

You’d use it appropriatelly like that in your activity:

Here is what I came up with:

Enjoy. (:

Android libgdx ShaderAssetLoader & StillModelLoader

I totally love how libgdx brings a lot of interfaces for your application to connect to the graphics library. For instance the asset manager is really thought through well in particular. It has some really useful methods like Assets.manager.getProgress(). Especially since you can easily write your own asset loader and be able to utilize the loading progress in your app.

1) Simply add your loader to the asset manager at some point.

2) load your assets at required places, e.g. loading screen
(Note: SHADER_PHONG = “data/Graphics/Shader/Phong”; and MODEL_TEAPOT = “data/Graphics/Shader/teapot.obj”)

3) get your shader or model wherever you need them

4) free the resource by unloading when you’re done with them (e.g. disposing your app; changing screens)

That’s the shader asset loader for loading custom shaders in libgdx. (Note: adapt your extensions)

And here is the StillModel loader for loading 3D meshes:

Conclusion: assets are handled well in libgdx :D

Android: Saving Screenshots in OpenGLES

1) Get your helper methods:

2) get a queue ready

3) add new filepath the the queue via e.g. events:

4) IMPORTANT! save the screen at the end of the opengl render process. (Note: If try to capture somewhere in the middle you might end up with a black screen or any other funny effects.)

WebGL: Three.js and particles from black and white shape

Well Three.js is amazing:

Just adapted the black and white shape image to this Particle Shape Tween. Which basically replaces the shape with particles.

WebGL: Earth Texture Shader

At university my computer graphic professor Hartmut Schirmacher gave us an excercise to implement various effects on a sphere in webgl with shaders based on his given webgl framework. His framework made it fairly easy though. Well here it is:

The features are:

  • Day and night light with smooth transition
  • Day changes based on the month
  • Moving clouds, which alternate in intensity over time
  • Wireframe and equator ring for orientation purposes
  • Specular lights based on barythmetic map
  • Height based on topyographic map
  • Bump map (work in progress)
  • Rotate with [Left click]
  • Drag with [Shift] + [Left click]
  • Zoom with [Alt] + [Left click]

All textures are taken from NASA’s Blue Marble collection.

This is my solution to cg2 exercersise a03.

WebGL: Robot

Another lovely javascript excerise. Just uncheck the animation to control it better.

This is my solution to cg2 exercersise a02.5-2.6.

WebGL: Backface Culling and Depth Test

One interesting part is the z-fighting, which doesn’t happen with polygon offset fill.

This is my solution to cg2 exercersise a02.1-2.4.

WebGL: warmup

What are the pros/cons of WebGL?
Read Quote of Henrik Bennetsen’s answer to What are the pros/cons of WebGL? on Quora

This is my “solution” to cg2 exercersise a00-warmup.

Earth Seasons Shader for Android

In computer graphic 2 we were supposed to create a earth seasons shader. Here is the one I did for android:

earth shader image earth shader image2

Simple vertex shader

and the fragment/pixel shader:

Maybe this isn’t the most efficient way but it is a way and one that works nonetheless. (:

InfoINI Android App

Today I’ve uploaded a new version of the InfoINI app (v1.8).

infoini appinfoini app

This little app is a tribute to the student representatives who work rather hard to help students. They organize events like first semester indroduction, christmas party. They always try to keep an open room for students to get help, information or just want to hang out in the student representatives room at the Beuth University Berlin.

The initial problem was that you never knew if someone is present. So you might have ended up with walking over the entire campus just to find out that the door is closed. With this app however you can just look it up. This works because a door sensor has been installed and has been connected to the webserver.

As you can see the room has grown to be more than just a student represtatives office, even though the AStA says different. It’s cousy because it has couches and coffee. People use it as a learning room and a place to hang out in free hours.

After a while Mirko and Patrick had an idea: What if we could also display how many coffee cups are left? So the both of them and later Hermann build a sensor to weigh the coffee Thermos flask and connected it also to the webserver.

So I added this feature the app, too.