【发布时间】:2013-06-07 09:16:02
【问题描述】:
我正在尝试显示立方体并旋转它。我已经成功地做到了glkview drawinrect delegate method called only once
我已经从这里http://www.raywenderlich.com/5235/beginning-opengl-es-2-0-with-glkit-part-2 获取了设置多维数据集的代码,我在上面引用的链接中提到了。
现在我的问题是我想增加立方体的大小。
这是使我的代码旋转的代码。
#pragma mark - GLKViewControllerDelegate
- (void)update {
float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 4.0f, 10.0f);
self.effect.transform.projectionMatrix = projectionMatrix;
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -6.0f);
_rotation += -90 * self.timeSinceLastUpdate;//90 clockwise -90 anticlickwise
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, GLKMathDegreesToRadians(0), 1, 0, 0);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, GLKMathDegreesToRadians(_rotation), 0, 1, 0);
self.effect.transform.modelviewMatrix = modelViewMatrix;
}
有人可以指导我如何增加我的立方体吗? 提前致谢。
【问题讨论】:
-
您发布的代码甚至不是设置多维数据集的代码。
-
我已经从这里raywenderlich.com/5235/… 获取了设置多维数据集的代码,我在上面引用的链接stackoverflow.com/questions/16962882/… 中提到了这一点
-
那么你已经尝试了什么?
标签: iphone opengl-es cube glkview