Help on using pod file from blender in opengl

Hi,
I’ve made an airplane with blender to use in an iPhone animation. Scale, rotation and translation will be in the application then I’ve execute a clear of rotation/translation/scale/orgin and then the airplane in blender is shown as you can see in the attached screenshot.
In the application the airplane will be viewed from the top (you can see in the app screenshot attached). By now I have:

  • put the airplane in the center of the viewport. I’ve imported it converting the blender file in collada and then in pod file (I’m using the powervr library)
  • set one light

And now I want to set the viewmatrix to view the airplane from the top. I’m using the following LookAt function I’ve taken from the book I’m reading (iPhone 3D Programming), here is the code:

static Matrix4<T> LookAt(const Vector3<T>& eye,
const Vector3<T>& target,
const Vector3<T>& up)
{
Vector3<T> z = (eye - target).Normalized();
Vector3<T> x = up.Cross(z).Normalized();
Vector3<T> y = z.Cross(x).Normalized();

Matrix4&lt;T&gt; m;
m.x = Vector4&lt;T&gt;(x, 0);
m.y = Vector4&lt;T&gt;(y, 0);
m.z = Vector4&lt;T&gt;(z, 0);
m.w = Vector4&lt;T&gt;(0, 0, 0, 1);

Vector4&lt;T&gt; eyePrime = m * Vector4&lt;T&gt;(-eye, 1);
m = m.Transposed();
m.w = eyePrime;

return m;

}

Considering that:

  • the airplane is on the x-z axes (on the screenshot there are also the axes)

  • the airplane is in the origin (I haven’t translated it)
    I thought to set eye, target, up in the following mannner:

    vec3 eye(0.0, 6.0, 0.0);
    vec3 target(0, 0, 0);
    vec3 up(1.0, 0.0, 0.0);
    m_mView = mat4::LookAt(eye, target, up);

that is moving the eye on the y-axis but the airplane wasn’t shown. Instead I’ve obtained the desired result with in the following manner:

vec3 eye(0.0, 0.0, -6.0);
vec3 target(0, 0, 0);
vec3 up(1.0, 0.0, 0.0);
m_mView = mat4::LookAt(eye, target, up);

Con you help me to understand the lookAt behaviour?
If you can suggest me some readings about that I’ll be really glad

Thanks.
Jean.

Attachments



airplane10.blend (130 KB)