ios - GLKMathProject gives me estrange numbers -
i can not screen coordinates, big numbers when use code below, can tell me why, position of x, y in radians, wrong ?
float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height); glkmatrix4 projectionmatrix = glkmatrix4makeperspective(glkmathdegreestoradians(_overture), aspect, 0.1f, 400.0f); projectionmatrix = glkmatrix4rotate(projectionmatrix, es_pi, 1.0f, 0.0f, 0.0f); glkmatrix4 modelviewmatrix = glkmatrix4identity; modelviewmatrix = glkmatrix4scale(modelviewmatrix, 300.0, 300.0, 300.0); modelviewmatrix = glkmatrix4rotatex(modelviewmatrix, 0.296706); modelviewmatrix = glkmatrix4rotatey(modelviewmatrix, -0.858702); _modelviewprojectionmatrix = glkmatrix4multiply(projectionmatrix, modelviewmatrix); cgsize viewsize = self.view.bounds.size; int viewport[4]; viewport[0] = 0; viewport[1] = 0; viewport[2] = (int)viewsize.width; viewport[3] = (int)viewsize.height; pos.x = 0.296706; //radians pos.y = -0.858702; //radians glkvector3 coor2 = glkvector3make(pos.x, pos.y, 0); glkvector3 windowvector = glkmathproject(coor2, modelviewmatrix, projectionmatrix, viewport);
projectionmatrix 0.818481, 0.000000, 0.000000, 0.000000 0.000000, -1.091309, 0.000000, 0.000000 0.000000, 0.000000, 1.000500, 1.000000 0.000000, 0.000000, -0.200050, 0.000000
modelviewmatrix 196.026169, -66.397179, 217.175415, 0.000000 0.000000, 286.891449, 87.711510, 0.000000 -227.098526, -57.312504, 187.460770, 0.000000 0.000000, 0.000000, 0.000000, 1.000000
_modelviewprojectionmatrix : 160.443787, 72.459831, 217.284042, 217.175415 0.000000, -313.087097, 87.755409, 87.711533 -185.875931, 62.545647, 187.554535, 187.460770 0.000000, 0.000000, -0.200050, 0.000000
it looks camera @ (0,0,0) looking @ m41,m42,m43 of modelviewmatrix , object's coor2.z = 0. @ center of object. might problem?
Comments
Post a Comment