【问题标题】:how to increase the size of the cube-openGL [closed]如何增加立方体openGL的大小[关闭]
【发布时间】: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;

}

有人可以指导我如何增加我的立方体吗? 提前致谢。

【问题讨论】:

标签: iphone opengl-es cube glkview


【解决方案1】:

在做实验后,将 GLKMathDegreesToRadians 值降低到较小的值会增加我的立方体大小。问题解决了。

GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(35.0f), aspect, 4.0f, 10.0f);    

【讨论】:

    猜你喜欢
    • 2013-08-29
    • 2015-06-26
    • 1970-01-01
    • 1970-01-01
    • 2023-01-15
    • 2013-04-03
    • 1970-01-01
    • 2014-05-21
    • 2012-11-07
    相关资源
    最近更新 更多