Examples of GLWindow


Examples of com.jogamp.newt.opengl.GLWindow

//            tGLCapabilities.setAccumBlueBits(16);
//            tGLCapabilities.setAccumGreenBits(16);
//            tGLCapabilities.setAccumRedBits(16);

        if (TOOLKIT == Toolkit.NEWT || TOOLKIT == Toolkit.NEWT_CANVAS) {
            final GLWindow newt = GLWindow.create(glcaps);

            final NewtListener listener = new NewtListener();
            newt.addKeyListener(listener);
            newt.addMouseListener(listener);

            drawable = newt;
        } else {
            final GLCanvas glCanvas = new GLCanvas(glcaps);

            final AwtListener listener = new AwtListener();
            glCanvas.addKeyListener(listener);
            glCanvas.addMouseListener(listener);
            glCanvas.addMouseMotionListener(listener);
            glCanvas.addMouseWheelListener(listener);

            drawable = glCanvas;
        }

        animator = new FPSAnimator(drawable, 30);

        if (TOOLKIT == Toolkit.NEWT) {
            final GLWindow window = (GLWindow) drawable;

            window.addWindowListener(new com.jogamp.newt.event.WindowAdapter() {
                @Override
                public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) {
                    animator.stop();
                    System.exit(0);
                }
            });
            window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            window.setTitle(WINDOW_TITLE);
            window.setVisible(true);
            this.window = window;
        } else {
            final Component canvas;

            if (TOOLKIT == Toolkit.NEWT_CANVAS)
                canvas = new NewtCanvasAWT((GLWindow) drawable);
            else
                canvas = (GLCanvas) drawable;

            final Frame window = new Frame();

            window.addWindowListener(new java.awt.event.WindowAdapter() {
                @Override
                public void windowClosing(java.awt.event.WindowEvent windowevent) {
                    animator.stop();
                    window.remove(canvas);
                    window.dispose();
                    System.exit(0);
                }
            });

            window.add(canvas);
            window.pack();
            canvas.requestFocusInWindow();
            window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            window.setTitle(WINDOW_TITLE);
            window.setVisible(true);
            this.window = window;
        }

        drawable.addGLEventListener(this);
        animator.start();
View Full Code Here

Examples of com.jogamp.newt.opengl.GLWindow

    private NewtCanvasAWT glCanvas;
    private final GLUT glut = new GLUT();

    public NewtGraphCanvas() {
        super();
        GLWindow glWindow1 = GLWindow.create(getCaps());
        glCanvas = new NewtCanvasAWT(glWindow1);
        glCanvas.setFocusable(true);
        glCanvas.setIgnoreRepaint(true);

        super.initDrawable(glWindow1);
View Full Code Here

Examples of com.jogamp.newt.opengl.GLWindow

  public static void main(String... args){
//    GLProfile glp = GLProfile.getDefault(GLProfile.getDefaultDevice());
    GLProfile glp = GLProfile.get(GLProfile.GL4);
    GLCapabilities caps = new GLCapabilities(glp);
    GLWindow window = GLWindow.create(caps);
   
    SpritesListener listener = new SpritesListener(new Configuration(null, null, 800, 600, 800, 600));
   
    Animator animator = new Animator(window);
   
    window.setVisible(true);
    animator.start();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.