Question

I am trying to display cube and rotating it.I have succeded in doing this glkview drawinrect delegate method called only once

I have taken the code to set up the cube from here http://www.raywenderlich.com/5235/beginning-opengl-es-2-0-with-glkit-part-2 which I mentioned in the above referenced link.

Now my problem is I want to increase the size of my cube.

Here is the code which makes my code to rotate.

#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;

}

Can someone guide me how to increase my cube? Thanks in advance.

Was it helpful?

Solution

After doing experiments,in decreasing GLKMathDegreesToRadians value to lesser values increasing my cube size.problem solved.

GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(35.0f), aspect, 4.0f, 10.0f);    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top