 # OpenglES 1.1 for ARMv4i. Problem with LooktAt!!

Hi, i’m Lucas. I’m have a problem. When i use the LookAt function (make by me) in c# over a ARMv4i, Opengl draw any thing. Draw erroneous images. Here are the code that i’m usign:

``````
public static unsafe void LookAtd(double centerx, double centery, double centerz, double eyex,
double eyey, double eyez, double upx, double upy, double upz)
{
var forward = new double;
var side = new double;
var up = new double;
var m = new float[4, 4];

forward = eyex - centerx;
forward = eyey - centery;
forward = eyez - centerz;

//normalizef(forward)
var r = Math.Sqrt(forward*forward + forward*forward +
forward*forward);

if (r == 0.0f)
return;

r = 1.0f/r;

forward *= r;
forward *= r;
forward *= r;
//fin normalizef(forward)

up = upx;
up = upy;
up = upz;

//crossf(forward, up, side)
side = forward*up - forward*up;
side = forward*up - forward*up;
side = forward*up - forward*up;
//fin crossf(forward, up, side)

//normalizef(side)
r = Math.Sqrt(side*side + side*side +
side*side);

if (r == 0.0f)
return;

r = 1.0f/r;

side *= r;
side *= r;
side *= r;

up = upx;
up = upy;
up = upz;
//fin normalizef(side)

//crossf(side, forward, up)
up = side*forward - side*forward;
up = side*forward - side*forward;
up = side*forward - side*forward;
//fin crossf(side, forward, up)

//__identf(&m)
m[0, 3] = m[1, 3] = m[2, 3] = m[3, 0] = m[3, 1] = m[3, 2] = 0;

m[3, 3] = 1;
//fin __identf(&m)

m[0, 0] = (float)side;
m[1, 0] = (float)side;
m[2, 0] = (float)side;

m[0, 1] = (float)up;
m[1, 1] = (float)up;
m[2, 1] = (float)up;

m[0, 2] = (float)-forward;
m[1, 2] = (float)-forward;
m[2, 2] = (float)-forward;

fixed (float* punterom = m)
{
gl.MultMatrixf(punterom);
}

gl.Translatef((float)-centerx, (float)-centery, (float)-centerz);
}

``````

and the lookat call:

``````
gl.MatrixMode(gl.GL_MODELVIEW);