コード例 #1
0
  private void setLighting(GL10 gl) {
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);

    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[] {0.25f, 0.25f, 0.29f, 1f}, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[] {0.99f, 0.99f, 0.79f, 1f}, 0);
    // bright yellow light
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, new float[] {.9f, .9f, 1f, 1f}, 0);

    gl.glEnable(GL10.GL_COLOR_MATERIAL);
  }
コード例 #2
0
  @Override
  public void render() {
    GL10 gl = Gdx.gl10;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glDepthFunc(GL10.GL_LEQUAL);
    gl.glEnable(GL10.GL_COLOR_MATERIAL);
    gl.glEnable(GL10.GL_LIGHTING);
    gl.glEnable(GL10.GL_LIGHT0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosition, 0);
    gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightDiffuse, 0);

    camera.apply(Gdx.gl10);

    world.update();
  }