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.
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.
A loud "Fuck yeah!"
-From my heart (with James Hetfield's voice)
Contact me at:
Virtual reality - Lesson 6
So far we have managed to avoid any openGL initialization in our application. The reason for this is that the viewport and projection settings are handled by the the VirtualRealityView. However, in a real application there are other things we would like to initialize as well. We would like to be able to set the clear color, load textures, construct display lists and much more at the start up of our application. In this lesson we will learn how to register a callback to the VirtualRealityView which will be called at the initialization of the View, and that should be used for all custom initialization. The callback will here be used to set the rendering color to red.

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

First of all we start by creating the callback that will be used. To do this, add the following class as an inner class to the VRFirst class.
private VirtualRealityView.VRInitCallback vrInitCallback = new VirtualRealityView.VRInitCallback(){ public void init(GL10 gl, EGLConfig config){ gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); } };
These line of code requires that we import the GL10 and EGLConfig classes, which is done with
import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.egl.EGLConfig;
Now the only thing we have to do is to add the callback to our virtual reality view. Therefore, in the onCreate-method, add the following
Not very interesting, right?
The result of this lesson was nothing other than to change the color of the blocks. The VRInitCallback is however very important and is what will allow you to make all kinds of setup for your application, and it makes this lesson just as important as any of the previous ones.

Continue with lesson 7