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

The following examples show how to use com.jogamp.newt.opengl.GLWindow#setPosition() . 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: Papart.java    From PapARt with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
     * Force a fullscreen size (for projectors). This call removes the window
     * decoration: menu bars, and makets it fullscreen.
     *
     * @param w width in pixels.
     * @param h hegiht in pixels.
     * @param px location in pixels (from left).
     * @param py location in pixels (from top).
     */
    public void forceProjectorSize(int w, int h, int px, int py) {
        frameSize.set(w, h);
//        this.shouldSetWindowSize = true;
//        registerPost();

        GLWindow window = (GLWindow) applet.getSurface().getNative();
        window.setUndecorated(true);
        window.setSize(w, h);
        window.setPosition(px, py);
    }
 
Example 2
Source File: Papart.java    From PapARt with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Set the frame to default location given by the screenConfiguration.
 */
public void defaultFrameLocation() {
    ScreenConfiguration screenConfiguration = getDefaultScreenConfiguration(this.applet);
    this.applet.frame.setLocation(screenConfiguration.getProjectionScreenOffsetX(),
            screenConfiguration.getProjectionScreenOffsetY());

    GLWindow window = (GLWindow) applet.getSurface().getNative();
    window.setPosition(screenConfiguration.getProjectionScreenOffsetX(),
            screenConfiguration.getProjectionScreenOffsetY());
}
 
Example 3
Source File: UINewtDemo01.java    From jogl-samples with MIT License 5 votes vote down vote up
public static void main(final String[] args) {
    final GLProfile glp = GLProfile.getGL2ES2();
    final 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");
    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE);
    uiGLListener.attachInputListenerTo(window);
    window.addGLEventListener(uiGLListener);
    window.setVisible(true);

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

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

    animator.start();
}
 
Example 4
Source File: TestTextRendererNEWT00.java    From jogl-samples with MIT License 5 votes vote down vote up
static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) {
    Assert.assertNotNull(caps);

    final GLWindow window = GLWindow.create(caps);
    window.setSize(width, height);
    window.setPosition(10, 10);
    window.setTitle(title);
    Assert.assertNotNull(window);
    window.setVisible(true);

    return window;
}
 
Example 5
Source File: TestRegionRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) {
    Assert.assertNotNull(caps);

    final GLWindow window = GLWindow.create(caps);
    window.setSize(width, height);
    window.setPosition(10, 10);
    window.setTitle(title);
    Assert.assertNotNull(window);
    window.setVisible(true);

    return window;
}
 
Example 6
Source File: TestTextRendererNEWT01.java    From jogl-samples with MIT License 5 votes vote down vote up
static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) {
    Assert.assertNotNull(caps);

    final GLWindow window = GLWindow.create(caps);
    window.setSize(width, height);
    window.setPosition(10, 10);
    window.setTitle(title);
    Assert.assertNotNull(window);
    window.setVisible(true);

    return window;
}
 
Example 7
Source File: GPURegionNewtDemo.java    From jogl-samples with MIT License 4 votes vote down vote up
public static void main(final String[] args) {
    int width = 800, height = 400;
    int x = 10, y = 10;
    if( 0 != args.length ) {
        SceneMSAASamples = 0;
        GraphMSAASamples = 0;
        GraphVBAASamples = 0;
        GraphUseWeight = false;

        for(int i=0; i<args.length; i++) {
            if(args[i].equals("-smsaa")) {
                i++;
                SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples);
            } else if(args[i].equals("-gmsaa")) {
                i++;
                GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples);
                GraphVBAASamples = 0;
            } else if(args[i].equals("-gvbaa")) {
                i++;
                GraphMSAASamples = 0;
                GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples);
            } else if(args[i].equals("-gweight")) {
                GraphUseWeight = true;
            } else if(args[i].equals("-width")) {
                i++;
                width = MiscUtils.atoi(args[i], width);
            } else if(args[i].equals("-height")) {
                i++;
                height = MiscUtils.atoi(args[i], height);
            } else if(args[i].equals("-x")) {
                i++;
                x = MiscUtils.atoi(args[i], x);
            } else if(args[i].equals("-y")) {
                i++;
                y = MiscUtils.atoi(args[i], y);
            }
        }
    }
    System.err.println("Desired win size "+width+"x"+height);
    System.err.println("Desired win pos  "+x+"/"+y);
    System.err.println("Scene MSAA Samples "+SceneMSAASamples);
    System.err.println("Graph MSAA Samples"+GraphMSAASamples);
    System.err.println("Graph VBAA Samples "+GraphVBAASamples);
    System.err.println("Graph Weight Mode "+GraphUseWeight);

    final GLProfile glp = GLProfile.getGL2ES2();
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    if( SceneMSAASamples > 0 ) {
        caps.setSampleBuffers(true);
        caps.setNumSamples(SceneMSAASamples);
    }
    System.out.println("Requested: " + caps);

    int rmode = GraphUseWeight ? Region.VARWEIGHT_RENDERING_BIT : 0;
    int sampleCount = 0;
    if( GraphVBAASamples > 0 ) {
        rmode |= Region.VBAA_RENDERING_BIT;
        sampleCount += GraphVBAASamples;
    } else if( GraphMSAASamples > 0 ) {
        rmode |= Region.MSAA_RENDERING_BIT;
        sampleCount += GraphMSAASamples;
    }

    final GLWindow window = GLWindow.create(caps);
    window.setPosition(x, y);
    window.setSize(width, height);
    window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);

    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE);
    regionGLListener.attachInputListenerTo(window);
    window.addGLEventListener(regionGLListener);
    window.setVisible(true);

    //FPSAnimator animator = new FPSAnimator(60);
    final Animator animator = new Animator();
    animator.setUpdateFPSFrames(60, System.err);
    animator.add(window);

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

    animator.start();
}
 
Example 8
Source File: GPUTextNewtDemo.java    From jogl-samples with MIT License 4 votes vote down vote up
public static void main(final String[] args) {
    int width = 800, height = 400;
    int x = 10, y = 10;
    if( 0 != args.length ) {
        SceneMSAASamples = 0;
        GraphMSAASamples = 0;
        GraphVBAASamples = 0;

        for(int i=0; i<args.length; i++) {
            if(args[i].equals("-smsaa")) {
                i++;
                SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples);
            } else  if(args[i].equals("-gmsaa")) {
                i++;
                GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples);
                GraphVBAASamples = 0;
            } else if(args[i].equals("-gvbaa")) {
                i++;
                GraphMSAASamples = 0;
                GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples);
            } else if(args[i].equals("-width")) {
                i++;
                width = MiscUtils.atoi(args[i], width);
            } else if(args[i].equals("-height")) {
                i++;
                height = MiscUtils.atoi(args[i], height);
            } else if(args[i].equals("-x")) {
                i++;
                x = MiscUtils.atoi(args[i], x);
            } else if(args[i].equals("-y")) {
                i++;
                y = MiscUtils.atoi(args[i], y);
            }
        }
    }
    System.err.println("Desired win size "+width+"x"+height);
    System.err.println("Desired win pos  "+x+"/"+y);
    System.err.println("Scene MSAA Samples "+SceneMSAASamples);
    System.err.println("Graph MSAA Samples "+GraphMSAASamples);
    System.err.println("Graph VBAA Samples "+GraphVBAASamples);

    final GLProfile glp = GLProfile.getGL2ES2();

    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    if( SceneMSAASamples > 0 ) {
        caps.setSampleBuffers(true);
        caps.setNumSamples(SceneMSAASamples);
    }
    System.out.println("Requested: " + caps);

    int rmode = 0; // Region.VARIABLE_CURVE_WEIGHT_BIT;
    int sampleCount = 0;
    if( GraphVBAASamples > 0 ) {
        rmode |= Region.VBAA_RENDERING_BIT;
        sampleCount += GraphVBAASamples;
    } else if( GraphMSAASamples > 0 ) {
        rmode |= Region.MSAA_RENDERING_BIT;
        sampleCount += GraphMSAASamples;
    }

    final GLWindow window = GLWindow.create(caps);
    window.setPosition(x, y);
    window.setSize(width, height);
    window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);

    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE);
    // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32);
    window.addGLEventListener(textGLListener);
    window.setVisible(true);
    // FPSAnimator animator = new FPSAnimator(60);
    final Animator animator = new Animator();
    animator.setUpdateFPSFrames(60, System.err);
    animator.add(window);

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

    animator.start();
}