A gremlin that gets rubbed in my face all the time is that i'm still using GL10. I'm going to sort that out later as the mechanics of other underlying code is complex enough and is keeping me extremely busy in other parts of the program.
In the mean time GLU.gluLookAt( cameraPosition, centreOfView, upDirection ) should still work. But however much i change the parameters of the camera position and the centre of view - the object drawn doesn't shift a bit
Here is the GL code, something must be wrong with the order of the code. Does any one know? Thanks and Happy new year
BTW this is GLES on Android platform
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
gl.glClearDepthf(1.0f);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDepthFunc(GL10.GL_LEQUAL);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (height == 0) height = 1;
float aspect = (float)width / height;
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.0f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, 0.0f, 6.0f, 0.0f, 0.0f, -6.0f, 0.0f, 0.0f, 1.0f, 0.0f);
}
@Override
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
cPuzzle.setByteBuffers();
cPuzzle.rotateObj(gl);
cPuzzle.drawObj(gl);
}