Shpere get distorted in perspective projection view, why

Hi,

I’m a OPENGL ES beginner, what I want to do is call “glTranslatef(X,Y,Z)” to move a sphere object in a 3D scene.

The Sphere object looks fine when it’s position in (0,0,0), but when I call glTranslatef, the object became distorted.

I was using perspective projection view with code like this:

public void onSurfaceChanged(GL10 gl, int width, int height) {
	float ratio = (float) width / height;
	gl.glViewport(0, 0, width, height);
	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	gl.glFrustumf(-ratio*1, ratio*1, -1, 1, 0.1f, 1000);
    }

Did I miss anything ?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.