Now with new hope some will be proud
This is no hoax, no one pushed out
Receive a reprieve and be a pioneer
Break new ground of a new frontier
New ideas will surely get by
No deed, or dividend. Some may ask "Why?"
You'll find the solution, the answers in the sky
-Dave Mustaine
A hundred times every day I remind myself that my
inner and outer life are based on the labors of
other men, living and dead, and that I must exert
myself in order to give in the same measure as I
have received and am still receiving...
-Albert Einstein
The worthwhile problems are the ones you can really solve or help solve,
the ones you can really contribute something to. ...
No problem is too small or too trivial if we can really do something about it.
-Richard Feynman
I have only two rules which I regard as principles of conduct.
The first is: Have no rules.
The second is: Be independent of the opinion of others.
-Albert Einstein
In everything, do to others what you would want them to do to you.
-Jesus
What we are is the sum of 1000 lives
What we know is almost nothing at all
But we are what we are until the day we die
Together we will find the strength to go on
-Rise against (intentionally missquoted and
taken out of context)
We need to be the change we wish to see in the world.
-Mahatma Gandhi
Seven social sins:
politics without principles,
wealth without work,
pleasure without conscience,
knowledge without character,
commerce without morality,
science without humanity,
and worship without sacrifice.
-Mahatma Gandhi
If I have seen further it is only by standing on the shoulders of giants.
-Isaac Newton
It is not enough to have a good mind.
The main thing is to use it well.
-Descartes
A loud "Fuck yeah!"
-From my heart (with James Hetfield's voice)
Contact me at: the_name_of_the_site@gmail.com
Virtual reality - Lesson 5
We do now master how to setup a virtual reality project, how to create Renderables, add these to a Scene which is rendered by a VirtualRealityView. We do also know how to orient the camera and move in a 3D world that is tightly connected with our reality through the magnetic- and accelarator-sensors, as well as through the GPS. The only thing that is missing to build a first actuall augmented reality application is the ability to show the real world on the screen. This is what we will learn in this lesson.

For the complete files produced in this lesson, click here.
For the complete application produced in this lesson, click here.

Including a CameraView
To show the real world on the screen, we overlay the VirtualRealityView with a View called CameraView. This is done by including the CameraView together with a RelativeLayout in the layout file main.xml. As it is easier to display the result than to explain the additions, the result is shown here.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/fixOrigoButton" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="F" /> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.dafer45.virtualreality.VirtualRealityView android:id="@+id/virtualRealityView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:keepScreenOn="true" /> <com.dafer45.virtualreality.CameraView android:id="@+id/cameraView" android:layout_alignTop="@id/virtualRealityView" android:layout_alignBottom="@id/virtualRealityView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </RelativeLayout> </LinearLayout>

Permissions for camera access
The camera view uses the camera, and thus our application has to have permissions for camera access. These are obtained by adding the following lines to the end of the AndroidManifest.xml file, just before the tag </manifest> .
<uses-permission android:name="android.permission.CAMERA"/> <uses-feature android:name="android.hardware.camera"/> <uses-feature android:name="android.hardware.camera.autofocus"/>
Continue with lesson 6