onsdag 28 november 2012

OpenGL ES 2.0 with Android and something about Virtual Buffer Objects (VBO)

Feels great to go back to university studies after a summer hiatus! In this post I'm playing around with OpenGL or more specific OpenGL ES 2.0 which is a subset of OpenGL for embedded systems. OpenGL and computer graphics is a quite daunting topic to delve into, but I'm dissecting it bit for bit...

I did put together this demo Android application just to see some basic stuff like translating, scaling and rotating in action.

OpenGL ES Demo




















How to create and use Virtual Buffer Objects (VBOs) under Android.

Beginning with Android 2.2 (API Level 8), the framework supports the OpenGL ES 2.0 API specification according to the documentation but API Level 8 seems to be missing some functions in order to use VBOs so make sure that you are using at least API Level 9.


initialize phase

float[] data = {...};
FloatBuffer dataBuffer = FloatBuffer.wrap(data);

// create the buffer object and get a handle to it
IntBuffer buffer = IntBuffer.allocate(1);
GLES20.glGenBuffers(1, buffer);
int bufferObject = buffer.get(0);

// bind bufferObject to the GL_ARRAY_BUFFER
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufferObject);
// allocates memory and copy data over to OpenGL memory 
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, data.length * 4, dataBuffer, GLES20.GL_STATIC_DRAW);
// cleanup 
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);


rendering phase


GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufferObject);

GLES20.glEnableVertexAttribArray(...);

GLES20.glVertexAttribPointer(...);

GLES20.glDrawArrays(...);


onsdag 7 november 2012

Fridge

A small prototype app I made for a course project. I kinda let you manage your food items in your refrigerator with an expiration date and food quality warning system.


onsdag 24 oktober 2012

Zmessage

Did some messageboard thingy with HTML5, PHP and databases.




fredag 10 augusti 2012

Android and Sensors

Played around with some of the sensors Android offers as part of a course assignment.









torsdag 31 maj 2012

Weather (Väder) App

Did a weather application for Android as a course project.
The data sources comes from yr.no.

Features

  • Swedish language
  • Live wallpaper
  • Widget
  • Weather notifications
  • Weather history
  • +more










onsdag 9 maj 2012

GraphPlotter Revisited

This is my second attempt on writing some piece of software that can visualize graph structures.
My first attempt was quite messy so this time around I'm using a force-directed layout algorithm for some good "layouting" of the graph. Graph Plotter 2.0 is definitively an improvement if you ask me :)

Note if you wanna try it out, that the graph is represented as a file, where the first line contains the number of nodes and each remaining line defines an edge.
For example.
4
0 1
1 2
2 3
3 4

Google Drive download link - Graph Plotter 2.0

GUI of Graph Plotter 2.0

fredag 4 maj 2012

My Travel Diary

I did a travel diary application for Android together with 6 other fellow students from Sweden as part of an "Intensive Programme - Local Based Services" project course sponsored by the European Union.

Our application have the following features:

    • You to take and publish pictures with comments to the pictures.
    • You can track your travel.
    • Share your trip via social connectivity.
    • Web page for friends, family, and other interested to follow your trip.