예제 #1
0
 @Override
 public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) {
   eglContext = ((EGL10) EGLContext.getEGL()).eglGetCurrentContext();
   setupGL(gl);
   logConfig(config);
   updatePpi();
   Mesh.invalidateAllMeshes(app);
   Texture.invalidateAllTextures(app);
   ShaderProgram.invalidateAllShaderPrograms(app);
   FrameBuffer.invalidateAllFrameBuffers(app);
   Gdx.app.log("AndroidGraphics", Mesh.getManagedStatus());
   Gdx.app.log("AndroidGraphics", Texture.getManagedStatus());
   Gdx.app.log("AndroidGraphics", ShaderProgram.getManagedStatus());
   Gdx.app.log("AndroidGraphics", FrameBuffer.getManagedStatus());
   Display display = app.getWindowManager().getDefaultDisplay();
   this.width = display.getWidth();
   this.height = display.getHeight();
   mean = new WindowedMean(5);
   this.lastFrameTime = System.nanoTime();
   gl.glViewport(0, 0, this.width, this.height);
   isSurfaceCreated = true;
 }
  @Override
  public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) {
    eglContext = ((EGL10) EGLContext.getEGL()).eglGetCurrentContext(); // jw: added
    setupGL(gl);
    logConfig(config);
    updatePpi();

    Mesh.invalidateAllMeshes(app);
    Texture.invalidateAllTextures(app);
    ShaderProgram.invalidateAllShaderPrograms(app);
    FrameBuffer.invalidateAllFrameBuffers(app);

    if (AndroidLiveWallpaperService
        .DEBUG) { // to prevent creating too many string buffers in live wallpapers
      Gdx.app.debug("AndroidGraphics", Mesh.getManagedStatus());
      Gdx.app.debug("AndroidGraphics", Texture.getManagedStatus());
      Gdx.app.debug("AndroidGraphics", ShaderProgram.getManagedStatus());
      Gdx.app.debug("AndroidGraphics", FrameBuffer.getManagedStatus());
    }

    Display display = app.getWindowManager().getDefaultDisplay();
    this.width = display.getWidth();
    this.height = display.getHeight();
    mean = new WindowedMean(5);
    this.lastFrameTime = System.nanoTime();

    gl.glViewport(0, 0, this.width, this.height);

    // jw: moved to onSurfaceChanged (as in AndroidGraphics class)
    /*if (created == false) {
    	app.getListener().create();
    	created = true;
    	synchronized (this) {
    		running = true;
    	}
    }*/
  }