示例#1
0
    public void onDrawFrame(GL10 gl) {

      double time = System.currentTimeMillis();
      double elapsed = time - _lastDraw;
      _lastDraw = time;

      if (elapsed > 1000) elapsed = 60;

      elapsed = elapsed / 1000;

      float pitch = _sensor.getPitch();
      float roll = _sensor.getRoll();

      for (int i = 0; i < _scene.numChildren(); i++) {
        Object3d obj = _scene.getChildAt(i);
        if (obj != _down && obj != _up && obj != _east && obj != _west) {
          updateObject(obj, elapsed, _sensor.getAccelerometer(), roll, pitch);
        }
      }

      _renderer.onDrawFrame(gl);
    }
示例#2
0
 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   _renderer.onSurfaceCreated(gl, config);
   initScene();
 }
示例#3
0
 public void onSurfaceChanged(GL10 gl, int width, int height) {
   _renderer.onSurfaceChanged(gl, width, height);
 }