torsdag 20 december 2012

tisdag 11 december 2012

Big Boy Locator Deluxe

This app lets you find a Big Boy franchise near you in Sweden.
Simple as that!



 

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

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.



    onsdag 7 mars 2012

    My first Android application - 15 Puzzle Game

    Did a classic implementation of the 15 Puzzle game as a class project.
    Features
    - Different background pictures to choose among
    - animations
    - sound
    - highscore list

    Requires Android 2.3.3 or above. Enjoy!




     

    måndag 13 februari 2012

    A* and 15-Puzzle

    I have been trying to solve 15-Puzzles by using the A* (A-star) search algorithm. The A* search algorithm use not only the cost to reach the node (usually denoted g(x)) but also an estimated cost (usually denoted h(x)) to get from the node the goal node to determine the order in which the search visits nodes.
    The heuristic function h(x) plays a vital role here, with a good heuristic function fewer nodes will be generated and ultimately leads to smaller costs both in time and space.
    You can easily solve the 8-Puzzle with the Manhattan distance (MD) as your h(x) function but for the 15-Puzzle MD as your h(x) function is sadly not good enough.

    Below are some numbers I got when I run my A* algorithm with a h(x) function consisting of  MD and Linear Conflict (LC). LC improves the heuristic function a little but the search is still painfully slow and not viable for any real usage if the solution length are to "deep".

    MD + HVC
    solution length                     nodes generated
    19                                      497
    26                                      2696
    34                                      122941
    42                                      501595
    46                                      979602

    There is better heuristic functions out there but then it is not "simple" anymore and will take some time and brain power to implement. You may consider one of these: The Manhattan Pair Distance Heuristic by Bernard Bauer, use pattern databases or Walking Distance by Ken'ichiro Takahashi.


    UPDATE 2012-03-07
    I did improve the heuristic function by also taking in account the vertical linear conflict (VLC).
    Here are the new numbers.

    MD + HVC + VLC
    solution length                     nodes generated
    19                                      342
    26                                      1375
    34                                      97894
    42                                      104267
    46                                      508080

    onsdag 1 februari 2012

    Image effects

    Coded some pretty straightforward image effects such as bucket fill, blur, chroma key, edge finding and convert to ascii. Bucket fill is still to slow but the others run pretty smoothly.

    Original image.

    Bucket fill effect.
    Blur effect.
    Chroma key effect.


    Edge finding effect.
    Ascii effect.