Ejemplo n.º 1
0
 public void printScreen(
     int renderModes, GLAutoDrawable drawable, String dir, String objName, boolean exportAlpha)
     throws GLException, IOException {
   final String modeS = Region.getRenderModeString(renderModes);
   final String bname =
       String.format(
           "%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d",
           objName,
           drawable.getChosenGLCapabilities().getNumSamples(),
           TestTextRendererNEWT00.fontSizeFixed,
           drawable.getWidth(),
           drawable.getHeight(),
           modeS,
           vbaaSampleCount[0]);
   final String filename = dir + bname + ".png";
   if (screenshot.readPixels(drawable.getGL(), false)) {
     screenshot.write(new File(filename));
   }
 }
Ejemplo n.º 2
0
    @Override
    public void display(GLAutoDrawable drawable) {
      final GL2ES2 gl = drawable.getGL().getGL2ES2();

      gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
      gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

      final GLAnimatorControl anim = drawable.getAnimator();
      final float lfps = null != anim ? anim.getLastFPS() : 0f;
      final float tfps = null != anim ? anim.getTotalFPS() : 0f;

      // Note: MODELVIEW is from [ 0 .. height ]

      final long t1 = Platform.currentTimeMillis();

      // final float fontSize = TestTextRendererNEWT00.fontSize;

      fontSizeAnim += fontSizeDelta;
      if (fontSizeMin >= fontSizeAnim || fontSizeAnim >= fontSizeMax) {
        fontSizeDelta *= -1f;
      }

      final float pixelSize = font.getPixelSize(fontSizeFixed, dpiH);
      final float pixelSizeAnim = font.getPixelSize(fontSizeAnim, dpiH);

      final String modeS = Region.getRenderModeString(renderModes);

      if (false) {
        // renderString(drawable, font, pixelSize, "I - / H P 7 0", 0, 0, 0, 0, -1000f, true);
        // renderString(drawable, font, pixelSize, "A M > } ] ", 0, 0, 0, 0, -1000f, true);
        // renderString(drawable, font, pixelSize, "M", 0, 0, 0, 0, -1000f, true);
        // renderString(drawable, font, pixelSize, "0 6 9 a b O Q A M > } ] ", 0, 0, 0, 0, -1000f,
        // true);
        // renderString(drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000,
        // true);
        // renderString(drawable, font, pixelSize, textX2,        0, 0,   0, 0, -1000f, true);
        // renderString(drawable, font, pixelSize, text1,         0,    0, 0, -1000f, regionFPS); //
        // no-cache
        final String text1 =
            lfps
                + " / "
                + tfps
                + " fps, vsync "
                + gl.getSwapInterval()
                + ", elapsed "
                + (t1 - t0) / 1000.0
                + " s, fontSize "
                + fontSizeFixed
                + ", msaa "
                + drawable.getChosenGLCapabilities().getNumSamples()
                + ", "
                + modeS
                + "-samples "
                + vbaaSampleCount[0];
        renderString(drawable, font, pixelSize, text1, 0, 0, 0, 0, -1000, regionFPS); // no-cache
      } else {
        final String text1 =
            String.format(
                "%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f, msaa %d, %s-samples %d",
                lfps,
                tfps,
                gl.getSwapInterval(),
                (t1 - t0) / 1000.0,
                fontSizeFixed,
                drawable.getChosenGLCapabilities().getNumSamples(),
                modeS,
                vbaaSampleCount[0]);
        renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000, true);
        renderString(
            drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000, true);
        renderString(
            drawable, font, pixelSize, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 0, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, "Hello World", 0, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, "4567890123456", 4, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, "I like JogAmp", 4, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, "Hello World", 0, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, textX2, 0, 0, 0, -1000, true);
        renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000, regionFPS); // no-cache
        if (TextAnim) {
          renderString(
              drawable, font, pixelSizeAnim, text1, 0, 0, 0, -1000, regionFPSAnim); // no-cache
        }
      }
    }