0

我试过:

int viewport[4];
viewport[0] = 0;
viewport[1] = 480;
viewport[2] = 320;
viewport[3] = 480;

GLKVector3 x = GLKMathProject(position, effect.transform.modelviewMatrix, effect.transform.projectionMatrix, viewport);

NSLog(@"%@", NSStringFromGLKVector3(x));

position 是一个像这样的 GLKVector3 {3, 5, 6}

但它给了我一些奇怪的值:{1.52313e+12, 8.0313e+08, -160.131}

4

1 回答 1

1

您未初始化大部分视口数组。你可能的意思是:

int viewport[4];
viewport[0] = 0;
viewport[1] = 480;
viewport[2] = 320;
viewport[3] = 480;

或者,更短:

int viewport[4] = {0, 480, 320, 480};

旁注:不应该是{0, 0, 320, 480}(原点 0, 0)吗?

于 2012-08-28T12:34:05.740 回答