Archives for category: Uncategorized

The Joystick tutorial of Entertainment Technology Center (CMU) was really helpful for me to connect the controller.

If you want to check quickly on your Android device, which button triggers which input manager field in Unity settings, just use this apk: U3D controller map

Note: In my case, the buttons of the Gamepad are mapped differently on Android platform and on PC platform. You need to map them again under Input Manager  (Edit->Project Settings->Editor) before building for Android platform. I don’t know if there is any config file for this, so that I don’t manually enter the values while switching platforms. Any ideas?

 

Hello, stranger!

It’s been a while that I didn’t post here some tips and tricks. I was busy in the real world with theory building, PhD thesis writing, Lindy Hop dancing and Yoga!

Now, I’m back here to take some development notes, tips and tricks, hopefully useful for you, readers, too. This time the posts are gonna covering Unity + Google VR SDK + Android issues. You see where it is going? VR in action 🙂

Current Setup:

Cheers.

Don’t do this! 🙂 or do it carefully. I copied the ImageTargets sample to my Eclipse workspace folder and tried to build. Then I received errors on ndk-build pointing out that it cannot find QCAR library. If you want to use any sample project as the base of your new project:

  • get a copy of the sample project under same samples folder
  • open the copied project in Eclipse, right click project -> refactor -> rename
  • and if you want to renew the package structure, make sure that you rename the references in jni folder too.

this answer helped me handling the issue: https://ar.qualcomm.at/content/ndk-build-problem

 

Sometimes you can’t get some things, it happens. For example, I couldn’t learn how to set the parameters related to the count and indices of elements of glDrawElements function correctly until… today:

void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);

You can read the description from Khronos website:

http://www.khronos.org/opengles/documentation/opengles1_0/html/glVertexPointer.html

First of all you should set the vertex pointer array that you are gonna draw. Set the size parameter to specify how many coordinates define a vertex. For my case this is 2. – I’m not gonna explain other parameters –

Then you are gonna draw these vertices using,

void glDrawArrays(GLenum mode, GLint first, GLsizei count);

http://www.khronos.org/opengles/documentation/opengles1_0/html/glDrawArrays.html

I’m always mistaken by the count and indices parameters. first parameter should be set to the starting index of the vertex – not the starting index of the coordinate in the array. count parameter should be set to the number of vertices that you are gonna draw – not to the number of coordinates that represent the number of vertices you are drawing.

This is kind of a “note to self”. Hope it is also useful for you 🙂

What kept me busy lately was this issue: How to do orthographic rendering on top of a Vuforia scene? And, how to project 3D object’s coordinates onto the viewplane? (like using gluProject, but we don’t have GLU on NDK…)

I opened a thread on Vuforia forum about this, couldn’t get a reply but solved it by myself. If you are interested on this topic, read it from there 😉 https://ar.qualcomm.at/arforums/showthread.php?t=2197

p.s. I submitted my paper to ISMAR! – as a poster submission though 🙂 Hope to get significant results to submit it as a paper.

I’ve been busy with porting my java gles android code to ndk since my last post. But don’t lose faith! Keep up following if you are 🙂 If you aren’t, start following 🙂

Unfortunately there is no GLU support in NDK. Here is an explanation : http://newcod.uberfinity.com/research/glincludes and someone asking same question on this topic: http://stackoverflow.com/questions/7589563/can-i-use-glu-with-android-ndk . I’ll try to use the port they are talking about on this question, if it fails I’ll try to do gluProject by conventional matrix multiplications.

After starting to dig into ImageTargets example of Vuforia SDK, I noticed from the application log that my device was using OpenGL ES 2.0. I assumed that Android platform 2.1 was supporting OpenGL ES 2.0 already. But I read that Android SDK supports OpenGL ES 2.0 starting from Android version 2.2 (which is emphasized in this nice introduction from Android developers website. I recommend following this tutorial if you want to start coding on OpenGL ES 2.0 – that’s when I found out that GLES20 is not defined on Android 2.1).

How is my device using GLES 2.0? The answer is lying in NDK! Vuforia SDK examples are realizing all the rendering functions on NDK to increase graphics performance and Android NDK supports OpenGL ES 2.0 since March 2010 for Android devices 2.0 and higher (android_developer_ndk / revision 3 and engadget). Mystery solved 🙂

Have fun with GLES2.0!

Yet another day that Eclipse made a joke to me 🙂 – yeah, we are getting friendlier 😉

My Macbook gave a “startup disk almost full” warning while Eclipse was on. The warning was because of some other reason though. So i quitted each application and restarted my macbook and eclipse. While starting Eclipse it gave an error pop up, but I clicked “OK” so fast that I didn’t notice what happened exactly. Then, there was nothing on the UI, just two buttons and the top menu for sure.. I thought that this was a problem of workspace and loaded it again. It loaded and built the workspace without any problems. I followed this process from the bottom info bar of Eclipse. But again, there was nothing on the UI. So what could be the problem, workspace was loaded and built but no UI?? Then I checked the top menu, if I can enable something or not…  Window->Open Perspective-> Java (default) saved me! It was just a problem of perspective 😉 

Lesson learned: Change your perspective if  you really want to solve a problem 😉

Looks too much like a draft, but I hope it summarizes the flow of onCreate () for you, too.

Image

After preparing the IDE, I am digging into the ImageTargets example… Well implemented and quite complicated with all callbacks and asynchronous processes. While trying to understand it, I remembered myself to practice:

  • Android application cycle
  • GLSurfaceView and Renderer classes
  • OpenGL ES 2.0 (I am completely a newbie on this)
  • AsyncTask, Runnable, synchronized block, etc… (topics related to processes and threaded – which is always a total nightmare for me on any platform using any programming language)
  • NDK (I am completely a newbie on this, too)

It feels like starting from scratch, but I’ll try my best until my deadline! To get help from colleagues, I first need to know on which topic I need help 🙂

Currently I am trying to build a schematic from the project flow. It is becoming more clear how I can edit this code, but I need a little more time. As soon as I finish it, I’ll post it here!!