Java Code Examples for com.jogamp.newt.opengl.GLWindow#display()

The following examples show how to use com.jogamp.newt.opengl.GLWindow#display() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
public void test00RegionRendererNONE01() throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
//    caps.setOnscreen(false);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
    window.addGLEventListener(listener);

    listener.setTech(-20, 0, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 0, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 0,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
Example 2
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
public void test01RegionRendererNONE02() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 0, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 0, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 0,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
Example 3
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
@Test
public void test10RegionRendererMSAA01() throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
//    caps.setOnscreen(false);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
Example 4
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
public void test11RegionRendererMSAA02() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
Example 5
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
@Test
public void test20RegionRendererR2T01() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.getGL2ES2();

    final GLCapabilities caps = new GLCapabilities(glp);
    //caps.setOnscreen(false);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final GPURegionGLListener02  demo02Listener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT, 4, false, false);
    demo02Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo02Listener);

    final RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
Example 6
Source File: TestTextRendererNEWT00.java    From jogl-samples with MIT License 4 votes vote down vote up
public void testImpl(final int sceneMSAASamples, final int graphMSAASamples, final int graphVBAASamples) throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final 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+"]");

    final GLWindow window = createWindow("text-gvbaa"+graphVBAASamples+"-gmsaa"+graphMSAASamples+"-smsaa"+sceneMSAASamples, caps, 1024, 640);
    window.display();
    System.err.println("Chosen: "+window.getChosenGLCapabilities());
    if( WaitStartEnd ) {
        JunitTracer.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);

    final Animator anim = new Animator();
    anim.add(window);
    anim.start();
    anim.setUpdateFPSFrames(60, null);
    sleep();
    window.invoke(true, new GLRunnable() {
        @Override
        public boolean run(final GLAutoDrawable drawable) {
            try {
                textGLListener.printScreen(renderModes, drawable, "./", "TestTextRendererNEWT00-snap"+screenshot_num, false);
                screenshot_num++;
            } catch (final Exception e) {
                e.printStackTrace();
            }
            return true;
        }
    });
    anim.stop();
    if( WaitStartEnd ) {
        JunitTracer.waitForKey("Stop");
    }
    destroyWindow(window);
}
 
Example 7
Source File: TestTextRendererNEWT01.java    From jogl-samples with MIT License 4 votes vote down vote up
@Test
public void testTextRendererR2T01() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.getGL2ES2();

    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    System.err.println("Requested: "+caps);

    final GLWindow window = createWindow("text-vbaa1-msaa0", caps, 800,400);
    window.display();
    System.err.println("Chosen: "+window.getChosenGLCapabilities());

    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final TextGLListener textGLListener = new TextGLListener(rs, Region.VBAA_RENDERING_BIT, DEBUG, TRACE);
    textGLListener.attachInputListenerTo(window);
    window.addGLEventListener(textGLListener);

    if(textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0)) {
        textGLListener.setTech(-400, -30, 0f, -1000, 2);
        window.display();
        sleep();

        textGLListener.setTech(-400, -30, 0f,  -380, 3);
        window.display();
        sleep();

        textGLListener.setTech(-400, -20, 0f,   -80, 4);
        window.display();
        sleep();
    }

    if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
        textGLListener.setTech(-400, -30, 0f, -1000, 2);
        window.display();
        sleep();

        textGLListener.setTech(-400, -30, 0f,  -380, 3);
        window.display();
        sleep();

        textGLListener.setTech(-400, -20, 0f,   -80, 4);
        window.display();
        sleep();
    }

    destroyWindow(window);
}
 
Example 8
Source File: TestTextRendererNEWT01.java    From jogl-samples with MIT License 4 votes vote down vote up
@Test
public void testTextRendererMSAA01() throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);
    System.err.println("Requested: "+caps);

    final GLWindow window = createWindow("text-vbaa0-msaa1", caps, 800, 400);
    window.display();
    System.err.println("Chosen: "+window.getChosenGLCapabilities());

    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final TextGLListener textGLListener = new TextGLListener(rs, 0, DEBUG, TRACE);
    textGLListener.attachInputListenerTo(window);
    window.addGLEventListener(textGLListener);

    if(textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0)) {
        textGLListener.setTech(-400, -30, 0f, -1000, 0);
        window.display();
        sleep();

        textGLListener.setTech(-400, -30, 0,   -380, 0);
        window.display();
        sleep();

        textGLListener.setTech(-400, -20, 0,    -80, 0);
        window.display();
        sleep();
    }

    if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
        textGLListener.setTech(-400, -30, 0f, -1000, 0);
        window.display();
        sleep();

        textGLListener.setTech(-400, -30, 0,   -380, 0);
        window.display();
        sleep();

        textGLListener.setTech(-400, -20, 0,    -80, 0);
        window.display();
        sleep();
    }

    destroyWindow(window);
}