enigmagame

12-02-2008, 06:32 AM

Hi,

I've a problem with vertices projection. See this image:

http://img239.imageshack.us/img239/7760/weight1sm7.th.jpg (http://img239.imageshack.us/my.php?image=weight1sm7.jpg)

There are three points in this order:

-Red point (2.0, 2.0, 2.0)

-Green point (-2.0, 2.0, 2.0)

-Blue point (2.0, -2.0, 2.0)

Ok, now I need the projected coordinate of this three vertices. I proceed in this manner:

V1 = (2.0, 2.0, 2.0);

PM; //Is the projection matrix

MM; //Is the modelview matrix

TM = {(0.5 * 1024.0), 0.0, 0.0, 0.0, 0.0, (0.5 * 800.0), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, (0.5 * 1024.0), (0.5 * 800.0), 0.0, 1.0};

V1O = (2.0, 2.0, 2.0, 1.0);

V1O = TM*PM*MM*V1O;

V1 = V1O.perspectiveDivision();

In this manner I obtain a wrong result, because the resulting coordinate are these: (yellow numbers)

http://img201.imageshack.us/img201/5079/weight111jf5.th.jpg (http://img201.imageshack.us/my.php?image=weight111jf5.jpg)

Why the order is wrong? And way the second coordinate is wrong?

Thanks.

I've a problem with vertices projection. See this image:

http://img239.imageshack.us/img239/7760/weight1sm7.th.jpg (http://img239.imageshack.us/my.php?image=weight1sm7.jpg)

There are three points in this order:

-Red point (2.0, 2.0, 2.0)

-Green point (-2.0, 2.0, 2.0)

-Blue point (2.0, -2.0, 2.0)

Ok, now I need the projected coordinate of this three vertices. I proceed in this manner:

V1 = (2.0, 2.0, 2.0);

PM; //Is the projection matrix

MM; //Is the modelview matrix

TM = {(0.5 * 1024.0), 0.0, 0.0, 0.0, 0.0, (0.5 * 800.0), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, (0.5 * 1024.0), (0.5 * 800.0), 0.0, 1.0};

V1O = (2.0, 2.0, 2.0, 1.0);

V1O = TM*PM*MM*V1O;

V1 = V1O.perspectiveDivision();

In this manner I obtain a wrong result, because the resulting coordinate are these: (yellow numbers)

http://img201.imageshack.us/img201/5079/weight111jf5.th.jpg (http://img201.imageshack.us/my.php?image=weight111jf5.jpg)

Why the order is wrong? And way the second coordinate is wrong?

Thanks.