So I've set up the perspective for my view in the onSurfaceCreate method using this:
float size = .01f * (float) Math.tan(Math.toRadians(45.0) / 2);
float ratio = _width / _height;
// perspective:
gl.glFrustumf(-size, size, -size / ratio, size / ratio, 0.01f, 110.0f);
It's more or less identical to this tutorial:
http://www.droidnova.com/android-3d-game-tutorial-part-vi,436.html
BUT i want to be able to switch between 45.0 and other angles of view. When I try to change the values of gl.glFrustumf later, the screen goes blank! I can manually set the angle in the onSurfaceCreate method but I can't figure out how to have the option to change between 2 perspective views without restarting the app. Can anyone help?
Thanks for your time
Do you clear the projection matrix before calling glFrustum the second time? OpenGL somewhat unintuitively multiplies the frustum matrix with the previous matrix on the stack. If you call glFrustum several times in succession without resetting the projection matrix you will get a nonsensical result.