Exemplo n.º 1
0
  protected void drawSetup() {
    // View frustrum

    if (_scene.camera().frustum.isDirty()) {
      updateViewFrustrum();
    }

    // Camera

    _gl.glMatrixMode(GL10.GL_MODELVIEW);
    _gl.glLoadIdentity();

    GLU.gluLookAt(
        _gl,
        _scene.camera().position.x,
        _scene.camera().position.y,
        _scene.camera().position.z,
        _scene.camera().target.x,
        _scene.camera().target.y,
        _scene.camera().target.z,
        _scene.camera().upAxis.x,
        _scene.camera().upAxis.y,
        _scene.camera().upAxis.z);

    // Background color

    if (_scene.backgroundColor().isDirty()) {
      if (_scene.backgroundTransparent() == true) _gl.glClearColor(0, 0, 0, 0);
      else
        _gl.glClearColor(
            (float) _scene.backgroundColor().r() / 255f,
            (float) _scene.backgroundColor().g() / 255f,
            (float) _scene.backgroundColor().b() / 255f,
            (float) _scene.backgroundColor().a() / 255f);
      _scene.backgroundColor().clearDirtyFlag();
    }

    _gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    drawSetupLights();

    // Always on:
    _gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  }