예제 #1
0
  /**
   * OpenGL setup post-drawable creation Will be called upon windowed/full screen switch and the GL
   * instance might have changed, so all must be regenerated.
   */
  @Override
  protected void drawableIntialized() throws Exception {
    gl.glShadeModel(GLLightingFunc.GL_SMOOTH); // enable smooth shading
    gl.glClearDepth(1.0f); // set depth buffer
    gl.glEnable(GL.GL_DEPTH_TEST); // enable depth testing
    gl.glDepthFunc(GL.GL_LEQUAL); // depth testing mode
    gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // perspective calculations mode
    gl.glTexGeni(
        GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); // set mode S to sphere mapping
    gl.glTexGeni(
        GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); // set mode T to sphere mapping
    gl.glLineWidth(1.0f); // set line width

    // and reinit all the rest because the GL might have changed
    if (scene == null) {
      scene = new Scene(this);
    }
    scene.init();
  }