Kevin Vance - Nexus One Spinny Cube

Entries | Archive | Friends | Friends' Friends | User Info

02:10 pm

Nexus One Spinny Cube

Friday, June 4th, 2010
Previous Entry Share Next Entry

I bought a Nexus One 2 weeks ago, and I've started learning its programming environment. Since I've gotten into the habit of making a spinny cube for every platform (previously: V3 RAZR, NDS), here's my Android one:

This was my first experience with OpenGL ES, and gaaaaaaah it's not fun. I think some of that is also Android's Java implementation of it, since you have to jump through hoops to make the now-required geometry buffers in the required hardware format. For complex game engines, it doesn't matter. But for "my first OpenGL", what a difference! For example, drawing a quad:

Regular OpenGL OpenGL ES
gl.glVertex3f(0.0f, 0.0f, 0.0f);
gl.glVertex3f(1.0f, 0.0f, 0.0f);
gl.glVertex3f(1.0f, 1.0f, 0.0f);
gl.glVertex3f(0.0f, 1.0f, 0.0f);
final float quad[] = {
    0.0f, 0.0f, 0.0f,
    1.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f,
    1.0f, 1.0f, 0.0f,

int storageSize = quad.length * Float.SIZE / 8;
ByteBuffer quadStorage = ByteBuffer.allocateDirect(storageSize);

FloatBuffer quadBuffer = quadStorage.asFloatBuffer();

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, quadBuffer);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, quadBuffer.capacity()/3);

Anyway, continuing on with more Android this weekend. My goal is to write a little app for interacting with Nectarine. That should cover a range of GUI, network, XML parsing, and IPC tasks.

Link )Reply )

[User Picture]From: peadarog
2010-06-04 08:01 pm (UTC)
Congratulations on your cube and welcome to the nexus world! I love my phone -- mainly because of people like you who keep doing amazing things with it. I look forward to your first app.
(Reply) (Thread)
[User Picture]From: kvance
2010-06-04 09:13 pm (UTC)
Thanks! The library of apps impressed me as well. The android market has given me everything I've asked for except a good version of Mille Bornes!
(Reply) (Parent) (Thread)
[User Picture]From: peadarog
2010-06-04 10:30 pm (UTC)
I had to wikipedia mille bornes -- sounds like fun.
(Reply) (Parent) (Thread)