Exemplo n.º 1
0
  public void init(final GLAutoDrawable drawable) {
    super.init(drawable);

    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    final RenderState rs = getRenderer().getRenderState();

    gl.setSwapInterval(1);
    gl.glEnable(GL.GL_DEPTH_TEST);
    gl.glEnable(GL.GL_BLEND);
    rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f);

    createTestOutline();
  }
Exemplo n.º 2
0
 public GPURegionGLListener01(
     final RenderState rs,
     final int renderModes,
     final int sampleCount,
     final boolean debug,
     final boolean trace) {
   super(
       RegionRenderer.create(
           rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable),
       renderModes,
       debug,
       trace);
   rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
   setMatrix(-20, 00, -50, 0f, sampleCount);
 }
Exemplo n.º 3
0
  public static void main(String[] args) {
    GLProfile glp = GLProfile.getGL2ES2();
    GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);
    System.out.println("Requested: " + caps);

    final GLWindow window = GLWindow.create(caps);
    window.setPosition(10, 10);
    window.setSize(800, 400);
    window.setTitle("GPU UI Newt Demo 01");
    RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
    UIGLListener01 uiGLListener = new UIGLListener01(rs, DEBUG, TRACE);
    uiGLListener.attachInputListenerTo(window);
    window.addGLEventListener(uiGLListener);

    window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err);
    window.setVisible(true);

    final Animator animator = new Animator();
    animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err);
    animator.add(window);

    window.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_F4) {
              window.destroy();
            }
          }
        });
    window.addWindowListener(
        new WindowAdapter() {
          public void windowDestroyed(WindowEvent e) {
            animator.stop();
          }
        });

    animator.start();
  }
Exemplo n.º 4
0
  public void testImpl(
      final int sceneMSAASamples, final int graphMSAASamples, final int graphVBAASamples)
      throws InterruptedException {
    GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    if (0 < sceneMSAASamples) {
      caps.setSampleBuffers(true);
      caps.setNumSamples(sceneMSAASamples);
    }
    System.err.println(
        "Requested: "
            + caps
            + ", graph[msaaSamples "
            + graphMSAASamples
            + ", vbaaSamples "
            + graphVBAASamples
            + "]");

    GLWindow window =
        createWindow(
            "text-gvbaa"
                + graphVBAASamples
                + "-gmsaa"
                + graphMSAASamples
                + "-smsaa"
                + sceneMSAASamples,
            caps,
            1024,
            640);
    window.display();
    System.err.println("Chosen: " + window.getChosenGLCapabilities());
    if (WaitStartEnd) {
      UITestCase.waitForKey("Start");
    }

    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final int renderModes, sampleCount;
    if (graphVBAASamples > 0) {
      renderModes = Region.VBAA_RENDERING_BIT;
      sampleCount = graphVBAASamples;
    } else if (graphMSAASamples > 0) {
      renderModes = Region.MSAA_RENDERING_BIT;
      sampleCount = graphMSAASamples;
    } else {
      renderModes = 0;
      sampleCount = 0;
    }
    final TextRendererGLEL textGLListener = new TextRendererGLEL(rs, renderModes, sampleCount);
    System.err.println(textGLListener.getFontInfo());

    window.addGLEventListener(textGLListener);

    Animator anim = new Animator();
    anim.add(window);
    anim.start();
    anim.setUpdateFPSFrames(60, null);
    sleep();
    window.invoke(
        true,
        new GLRunnable() {
          @Override
          public boolean run(GLAutoDrawable drawable) {
            try {
              textGLListener.printScreen(
                  renderModes,
                  drawable,
                  "./",
                  "TestTextRendererNEWT00-snap" + screenshot_num,
                  false);
              screenshot_num++;
            } catch (Exception e) {
              e.printStackTrace();
            }
            return true;
          }
        });
    anim.stop();
    if (WaitStartEnd) {
      UITestCase.waitForKey("Stop");
    }
    destroyWindow(window);
  }