예제 #1
0
 public void run() {
   try {
     uglyjoglhack();
     if (state == null)
       throw (new RuntimeException("State applier is still null after redraw"));
     synchronized (drawfun) {
       drawfun.notifyAll();
     }
     while (true) {
       long then = System.currentTimeMillis();
       int waited = 0;
       synchronized (drawfun) {
         while ((curdraw = bufdraw) == null) drawfun.wait();
         bufdraw = null;
         drawfun.notifyAll();
         waited += System.currentTimeMillis() - then;
       }
       CPUProfile.Frame curf = null;
       if (Config.profile) curdraw.pf = curf = rprof.new Frame();
       uglyjoglhack();
       if (curf != null) {
         curf.tick("aux");
         curf.fin();
       }
       long now = System.currentTimeMillis();
       waited += now - curdraw.doneat;
       ridle = (ridle * 0.95) + (((double) waited / ((double) (now - then))) * 0.05);
       curdraw = null;
     }
   } catch (InterruptedException e) {
     return;
   }
 }
예제 #2
0
  void redraw(GL2 gl) {
    if ((state == null) || (state.cgl.gl != gl))
      state = new GLState.Applier(new CurrentGL(gl, glconf));

    Frame f = curdraw;
    if ((f != null) && (f.on.gl == gl)) {
      GPUProfile.Frame curgf = null;
      if (Config.profilegpu) curgf = gprof.new Frame((GL3) gl);
      if (f.pf != null) f.pf.tick("awt");
      f.buf.run(gl);
      GOut.checkerr(gl);
      if (f.pf != null) f.pf.tick("gl");
      if (curgf != null) {
        curgf.tick("draw");
        curgf.fin();
      }

      if (glconf.pref.dirty) {
        glconf.pref.save();
        glconf.pref.dirty = false;
      }
      f.doneat = System.currentTimeMillis();
    }
  }