I can not move the camera. I added a variable that increases, objects move but not the view point.
The code:
public void onSurfaceChanged(GL10 gl, int width, int height) {
if(height == 0) { height = 1; }
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
//Calculate The Aspect Ratio Of The Window
GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f);
GLU.gluLookAt( gl,10.0f, 10.0f, 10.0f, 0, 0, 0, 0, 0, 1);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gridVertexBfr = FloatBuffer.wrap(gridCoords);
gl.glEnable(GL10.GL_TEXTURE_2D); //Enable Texture Mapping
gl.glShadeModel(GL10.GL_SMOOTH); //Enable Smooth Shading
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); //Black Background
gl.glClearDepthf(1.0f); //Depth Buffer Setup
gl.glEnable(GL10.GL_DEPTH_TEST); //Enables Depth Testing
gl.glDepthFunc(GL10.GL_LEQUAL);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
}
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
GLU.gluLookAt( gl,10.0f, 10.0f, 10.0f+k, 0, 0, 0, 0, 0, 1);
// grid
gl.glLoadIdentity();
gl.glTranslatef(0, k, 0);
gl.glColor4f(0.2f, 0.2f, 0.2f, 1.0f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(2,GL10.GL_FLOAT,0,gridVertexBfr);
gl.glDrawArrays(GL10.GL_LINES, 0, 88);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
k = k + 0.02f;
}
Why does not it work?
Thank you.