private GLCanvas createGLCanvas(final GLCapabilitiesImmutable caps, final Dimension size) {
   final GLCanvas canvas = new GLCanvas(caps);
   canvas.setSize(size);
   canvas.setPreferredSize(size);
   canvas.setMinimumSize(size);
   return canvas;
 }
  public static void main(String[] args) {
    // Initialization
    // Setting up GL
    GLProfile.initSingleton();
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);
    GLCanvas canvas = new GLCanvas(caps);

    // Making the AWT frame window
    Frame frame = new Frame("Assignment 1");
    frame.setSize(800, 600);
    frame.add(canvas);
    frame.setVisible(true);

    // Adding a render listener
    canvas.addGLEventListener(new Assignment1());

    // Fixes so the exit button exits the program
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
  @BeforeClass
  public static void beforeClass() throws Exception {

    final GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new RedSquareES2());
    new AWTMouseAdapter(_testMouseListener, canvas).addTo(canvas);

    _testFrame = new JFrame("Event Modifier Test AWTCanvas");
    _testFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _testFrame.getContentPane().add(canvas);
            _testFrame.setBounds(TEST_FRAME_X, TEST_FRAME_Y, TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT);
            _testFrame.setVisible(true);
          }
        });
    Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true));
    Assert.assertTrue(AWTRobotUtil.waitForVisible(canvas, true));
    Assert.assertTrue(AWTRobotUtil.waitForRealized(canvas, true));

    AWTRobotUtil.assertRequestFocusAndWait(null, canvas, canvas, null, null); // programmatic
    Assert.assertNotNull(_robot);
    AWTRobotUtil.requestFocus(
        _robot, canvas,
        false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows
                // keyboard input
  }
Example #4
0
  private void initDraw() {
    if (TOOLKIT == AWT) {
      awtCanvas.setVisible(true);
      // Force the realization
      awtCanvas.display();
      if (awtCanvas.getDelegatedDrawable().isRealized()) {
        // Request the focus here as it cannot work when the window is not visible
        awtCanvas.requestFocus();
        context = awtCanvas.getContext();
      }
    } else if (TOOLKIT == NEWT) {
      newtCanvas.setVisible(true);
      // Force the realization
      newtWindow.display();
      if (newtWindow.isRealized()) {
        // Request the focus here as it cannot work when the window is not visible
        newtCanvas.requestFocus();
        context = newtWindow.getContext();
      }
    }

    drawRunnable = new DrawRunnable();

    doneInit = true;
  }
Example #5
0
  /** The entry main() method */
  public static void main(String[] args) {
    // Create the OpenGL rendering canvas
    GLCanvas canvas = new GLCanvas(); // heavy-weight GLCanvas
    canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
    canvas.addGLEventListener(new JOGL2Nehe11Flag());

    // Create a animator that drives canvas' display() at the specified FPS.
    final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);

    // Create the top-level container frame
    final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame
    frame.getContentPane().add(canvas);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            // Use a dedicate thread to run the stop() to ensure that the
            // animator stops before program exits.
            new Thread() {
              @Override
              public void run() {
                animator.stop(); // stop the animator loop
                System.exit(0);
              }
            }.start();
          }
        });
    frame.setTitle(TITLE);
    frame.pack();
    frame.setVisible(true);
    animator.start(); // start the animation loop
  }
Example #6
0
  public static void main(String[] args) {
    // 1. Configuración de OpenGL Version 2
    GLProfile profile = GLProfile.get(GLProfile.GL2);
    GLCapabilities capabilities = new GLCapabilities(profile);

    // 2. Canvas es el aplicativo gráfico que se empotra en un JFrame - Ventana
    GLCanvas glcanvas = new GLCanvas(capabilities);
    glcanvas.addGLEventListener(new Renderer_Circulo());

    glcanvas.setSize(600, 600);

    // 3. Crear la ventana para mostrar la aplicación de dibujo
    JFrame frame = new JFrame("Aplicación de OpenGL");
    frame.getContentPane().add(glcanvas);
    // 4. Añadir el evento para cerrar la ventana
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent ev) {
            System.exit(0);
          }
        });
    // 5. Cambiar el tamaño de la ventana y visualizarla
    frame.setSize(frame.getContentPane().getPreferredSize());
    frame.setVisible(true);
  }
Example #7
0
	public void start() throws IOException {
		
		canvas.addGLEventListener(new DrawPanel());
		setSize(800,600);
		animator.start();
		canvas.requestFocus();
		}
Example #8
0
 @Override
 protected GLCanvas createDrawable() {
   GLCapabilities caps = new GLCapabilities(null);
   caps.setSampleBuffers(true);
   //
   GLCanvas panel = new GLCanvas(caps);
   panel.addGLEventListener(this);
   panel.addKeyListener(this);
   return panel;
 }
  private void initGL() {
    GLProfile profile = GLProfile.getDefault();

    GLCapabilities capabilities = new GLCapabilities(profile);

    canvas = new GLCanvas(capabilities);

    canvas.setSize(imageWidth, imageHeight);

    canvas.addGLEventListener(this);
  }
Example #10
0
 public GameMenu(String title, int width, int height, int FPS) {
   fPS = FPS;
   frame = new JFrame(title);
   canvas = new DrawMenu();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   // Create the OpenGL rendering canvas
   canvas.setPreferredSize(new Dimension(width, height));
   canvas.addMouseListener(new SelectMenuListener());
   canvas.addMouseMotionListener(new MotionListener());
   frame.getContentPane().add(canvas);
   frame.pack();
 }
 GLFrame(JTextArea outputArea) {
   this.outputArea = outputArea;
   GLCapabilities caps = new GLCapabilities(Configuration.getMaxCompatibleGLProfile());
   caps.setAlphaBits(8);
   caps.setRedBits(8);
   caps.setGreenBits(8);
   caps.setBlueBits(8);
   GLCanvas glCanvas = new GLCanvas(caps);
   glCanvas.addGLEventListener(this);
   this.add(glCanvas);
   this.setSize(200, 200);
 }
Example #12
0
  public PickSquare() {
    super("picksquare");

    GLProfile profile = GLProfile.get(GLProfile.GL2);

    caps = new GLCapabilities(profile);
    canvas = new GLCanvas(caps);
    canvas.addGLEventListener(this);
    canvas.addKeyListener(this);
    canvas.addMouseListener(this);

    getContentPane().add(canvas);
  }
  public SwingScilabCanvasImpl(GLCapabilities cap) {
    if (enableGLCanvas) {
      Debug.DEBUG(this.getClass().getSimpleName(), "Using GLCanvas for OpenGL implementation.");
      realGLCanvas = new GLCanvas(cap);
      realGLCanvas.addMouseMotionListener(
          new MouseMotionListener() {
            public void mouseDragged(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }

            public void mouseMoved(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }
          });
      realGLCanvas.addMouseListener(
          new MouseListener() {
            public void mouseClicked(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }

            public void mouseEntered(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }

            public void mouseExited(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }

            public void mousePressed(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }

            public void mouseReleased(MouseEvent arg0) {
              arg0.setSource(realGLCanvas.getParent());
              realGLCanvas.getParent().dispatchEvent(arg0);
            }
          });
    } else {
      Debug.DEBUG(this.getClass().getSimpleName(), "Using GLJPanel for OpenGL implementation.");
      realGLJPanel = new GLJPanel(cap);
    }
  }
Example #14
0
 public void run() {
   setSize(512, 256);
   setLocationRelativeTo(null);
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setVisible(true);
   canvas.requestFocusInWindow();
 }
  @Override
  public void init(GLAutoDrawable glad) {
    System.out.println("init");

    canvas.setAutoSwapBufferMode(false);

    GL3 gl3 = glad.getGL().getGL3();

    buildShaders(gl3);

    programObject.bind(gl3);
    {
      programObject.setUniform(gl3, "frustumScale", new float[] {1.0f}, 1);
      programObject.setUniform(gl3, "zNear", new float[] {1.0f}, 1);
      programObject.setUniform(gl3, "zFar", new float[] {3.0f}, 1);
    }
    programObject.unbind(gl3);

    initializeVertexBuffer(gl3);

    gl3.glGenVertexArrays(1, IntBuffer.wrap(vertexArrayObject));
    gl3.glBindVertexArray(vertexArrayObject[0]);

    gl3.glEnable(GL3.GL_CULL_FACE);
    gl3.glCullFace(GL3.GL_BACK);
    gl3.glFrontFace(GL3.GL_CW);
  }
Example #16
0
 @Override
 public void paint(final java.awt.Graphics g) {
   if (animator != null) {
     super.paint(g);
   } else {
     display();
   }
 }
  public static void main(String[] args) {

    Frame frame = new Frame("Simple JOGL Application");

    // use GL2 profile since we only use the old OpenGL 2.x fixed function pipeline
    GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2));

    // try to enable 2x anti aliasing - should be supported on most hardware
    //        capabilities.setNumSamples(2);
    //        capabilities.setSampleBuffers(true);

    GLCanvas canvas = new GLCanvas(capabilities);

    canvas.addGLEventListener(new SimpleJOGL());
    frame.add(canvas);

    // use JOGL's Animator utility for rendering
    final Animator animator = new Animator(canvas);

    // stop the Animator when we receive a window closing event
    frame.addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {

                      public void run() {
                        animator.stop();
                        System.exit(0);
                      }
                    })
                .start();
          }
        });

    // Center frame, set its size and start rendering
    frame.setSize(640, 480);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    animator.start();
  }
Example #18
0
  public static void main(String[] args) {
    // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
    // <application-desc main-class="demos.j2d.TextCube"/>
    //   <argument>NotFirstUIActionOnProcess</argument>
    // </application-desc>
    boolean firstUIActionOnProcess =
        0 == args.length || !args[0].equals("NotFirstUIActionOnProcess");
    GLProfile.initSingleton();

    Frame frame = new Frame();
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Listener());
    frame.setUndecorated(true);
    frame.add(canvas);
    frame.setSize(1, 1);
    frame.setVisible(true);
  }
Example #19
0
  public static void main(String[] args) {
    GLProfile glprofile = GLProfile.getDefault();
    GLCapabilities glcapabilities = new GLCapabilities(glprofile);
    final GLCanvas glcanvas = new GLCanvas(glcapabilities);

    glcanvas.addGLEventListener(new ModelSnip());

    glcanvas.setIgnoreRepaint(true);

    Animator anim = new Animator(glcanvas);
    anim.start();

    JFrame jframe = new JFrame("Model GLEventListener");
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jframe.getContentPane().add(glcanvas, BorderLayout.CENTER);
    jframe.setSize(640, 480);
    jframe.setVisible(true);
  }
Example #20
0
  public static void main(String[] args) {
    // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
    // <application-desc main-class="demos.j2d.TextCube"/>
    //   <argument>NotFirstUIActionOnProcess</argument>
    // </application-desc>
    boolean firstUIActionOnProcess =
        0 == args.length || !args[0].equals("NotFirstUIActionOnProcess");
    GLProfile.initSingleton(firstUIActionOnProcess);

    GLCapabilities caps = new GLCapabilities(null);
    GLCanvas canvas = new GLCanvas(caps);

    FBCubes cubes = new FBCubes();
    canvas.addMouseListener(cubes);
    canvas.addMouseMotionListener(cubes);
    canvas.addGLEventListener(cubes);

    Frame frame = new Frame("FBCubes Demo ES 1.1");
    frame.add(canvas);
    frame.setSize(800, 480);

    final GLAnimatorControl animator = new FPSAnimator(canvas, 60);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        animator.stop();
                        System.exit(0);
                      }
                    })
                .start();
          }
        });

    frame.setVisible(true);
    animator.start();
  }
Example #21
0
 public static void main(String[] args) {
   final GLCanvas canvas = new GLCanvas();
   final Frame frame = new Frame("Jogl Quad drawing");
   final Animator animator = new Animator(canvas);
   canvas.addGLEventListener(new Test());
   frame.add(canvas);
   frame.setSize(640, 480);
   frame.setResizable(false);
   frame.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           animator.stop();
           frame.dispose();
           System.exit(0);
         }
       });
   frame.setVisible(true);
   animator.start();
   canvas.requestFocus();
 }
  @Override
  public GLAutoDrawable createGLAutoDrawable(
      final QuitAdapter quitAdapter,
      final GLCapabilitiesImmutable caps,
      final int width,
      final int height)
      throws InterruptedException, InvocationTargetException {
    final GLAutoDrawable glad;
    if (caps.isOnscreen()) {
      final Frame frame = new Frame("Gears AWT Test");
      Assert.assertNotNull(frame);

      final GLCanvas glCanvas = new GLCanvas(caps);
      Assert.assertNotNull(glCanvas);
      final Dimension glc_sz = new Dimension(width, height);
      glCanvas.setMinimumSize(glc_sz);
      glCanvas.setPreferredSize(glc_sz);
      glCanvas.setSize(glc_sz);
      glad = glCanvas;

      new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame);

      frame.setLayout(new BorderLayout());
      frame.add(glCanvas, BorderLayout.CENTER);
      javax.swing.SwingUtilities.invokeAndWait(
          new Runnable() {
            public void run() {
              frame.pack();
              frame.setVisible(true);
            }
          });
    } else {
      final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
      glad = factory.createOffscreenAutoDrawable(null, caps, null, width, height);
      Assert.assertNotNull(glad);
    }
    return glad;
  }
  public AnimationPanel(GLEventListener renderer, AnimationTrigger trigger, Dimension dim) {
    super(new MigLayout("insets 0, nogrid, center, fill", "center", "center"));

    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));

    _canvas = new GLCanvas(caps);
    _canvas.setName("glCanvas");
    _canvas.setMinimumSize(new Dimension(5, 5));
    setRenderer(renderer);

    if (trigger != null) {
      _defaultTrigger = null;
      _altTrigger = trigger;
      _altTrigger.setCanvas(_canvas);
    } else {
      _altTrigger = null;
      _defaultTrigger = new Animator(_canvas);
      _defaultTrigger.setPrintExceptions(true);
    }

    add(_canvas);
    setSize(dim);
  }
Example #24
0
  public Issue326Test1() {
    super("TextTest");
    this.setSize(800, 800);
    canvas = new GLCanvas();
    canvas.addGLEventListener(this);
    add(canvas);

    setVisible(true);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
Example #25
0
  public void requestDraw(CountDownLatch latch) {
    if (!doneInit) {
      initDraw();
    }

    if (TOOLKIT == AWT) {
      awtCanvas.invoke(true, drawRunnable);
    } else if (TOOLKIT == NEWT) {
      newtWindow.invoke(true, drawRunnable);
    }

    if (latch != null) {
      latch.countDown();
    }
  }
Example #26
0
  private void initGL() {
    GLProfile profile = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(profile);
    caps.setBackgroundOpaque(true);
    caps.setOnscreen(true);
    caps.setSampleBuffers(false);

    if (TOOLKIT == AWT) {
      awtCanvas = new GLCanvas(caps);
      awtCanvas.setBounds(0, 0, applet.width, applet.height);
      awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
      awtCanvas.setFocusable(true);

      applet.setLayout(new BorderLayout());
      applet.add(awtCanvas, BorderLayout.CENTER);

      if (MANUAL_FRAME_HANDLING) {
        awtCanvas.setIgnoreRepaint(true);
        awtCanvas.setAutoSwapBufferMode(false);
      }
    } else if (TOOLKIT == NEWT) {
      newtWindow = GLWindow.create(caps);
      newtCanvas = new NewtCanvasAWT(newtWindow);
      newtCanvas.setBounds(0, 0, applet.width, applet.height);
      newtCanvas.setBackground(new Color(0xFFCCCCCC, true));
      newtCanvas.setFocusable(true);

      applet.setLayout(new BorderLayout());
      applet.add(newtCanvas, BorderLayout.CENTER);

      if (MANUAL_FRAME_HANDLING) {
        newtCanvas.setIgnoreRepaint(true);
        newtWindow.setAutoSwapBufferMode(false);
      }
    }
  }
Example #27
0
  public Engine(GLCanvas canvas) {
    frame = new Frame("TRIPPIN' BALLS");
    frame.add(canvas);
    frame.setSize(600, 600);
    if (fullscreen) frame.setUndecorated(true);
    frame.setVisible(true);

    if (fullscreen) {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      ge.getDefaultScreenDevice().setFullScreenWindow(frame);
    }

    input = new Input();
    frame.addWindowListener(input);
    canvas.addKeyListener(input);
    canvas.addMouseListener(input);
    canvas.addMouseWheelListener(input);
    canvas.addFocusListener(input);

    animator = new FPSAnimator(canvas, 60);
    animator.add(canvas);
    animator.start();
    animator.getTotalFrames();
  }
Example #28
0
  private void initComponents(GLCapabilities caps) {
    canvas = new GLCanvas(caps);
    canvas.setFocusTraversalKeysEnabled(false);

    frame = new RVFrame("RoboViz");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            shutdown();
          }
        });
    frame.setIconImage(Globals.getIcon());
    frame.setLayout(new BorderLayout());
    frame.add(canvas, BorderLayout.CENTER);
    restoreConfig();
    frame.setVisible(true);
    attachDrawableAndStart(canvas);
  }
Example #29
0
 public void mousePressed(MouseEvent mouse) {
   if (mouse.getButton() == MouseEvent.BUTTON1) {
     pickPoint = mouse.getPoint();
     canvas.display();
   }
 }
  static {
    long lastTime = Calendar.getInstance().getTimeInMillis();

    Debug.DEBUG("SwingScilabCanvasImpl", "=======================================");
    String OS_NAME = System.getProperty("os.name");
    Debug.DEBUG("SwingScilabCanvasImpl", "os.name=" + OS_NAME);
    String OS_ARCH = System.getProperty("os.arch");
    Debug.DEBUG("SwingScilabCanvasImpl", "os.arch=" + OS_ARCH);
    Debug.DEBUG("SwingScilabCanvasImpl", "=======================================");

    /*
     * Bug #7526: moved out of the try/catch block since it contains
     * no OpenGL calls.
     */
    if (OS_NAME.contains("Windows") && OS_ARCH.equals("amd64")) {
      // bug 3919 : JOGL x64 doesn't like x64 remote desktop on Windows
      // @TODO : bug report to JOGL
      String REMOTEDESKTOP = System.getenv("SCILAB_MSTS_SESSION");
      if (REMOTEDESKTOP != null) {
        if (REMOTEDESKTOP.equals("OK")) {
          noGLJPanel = true;
        }
      }

      if (noGLJPanel) {
        /** Inform the users */
        InterpreterManagement.requestScilabExec(
            String.format(
                "disp(\"%s\"), disp(\"%s\")",
                String.format(
                    Messages.gettext(
                        "WARNING: Due to your configuration limitations, Scilab switched in a mode where mixing uicontrols and graphics is not available. Type %s for more information."),
                    "\"\"help usecanvas\"\""),
                String.format(
                    Messages.gettext("In some cases, %s fixes the issue"),
                    "\"\"system_setproperty(''jogl.gljpanel.nohw'','''');\"\"")));
      }
    }

    /*
     * Bug #7526: this code block causes a crash on Windows and Intel Graphic HD cards
     * with graphics drivers older than 8.15.10.2279 and is therefore not executed if
     * Windows is the OS (the tests on driver and OpenGL versions are Linux-specific).
     * Consequently, updateMaxCanvasSize, which determines the canvas size, is not called
     * any more on Windows. However, it is still called when an actual graphics window is created
     * (by the renderer module's SciRenderer init method), which still allows getting the maximum
     * canvas dimensions, so this should not be an issue.
     */
    if (!OS_NAME.contains("Windows")) {

      try {
        GLCanvas tmpCanvas = new GLCanvas(new GLCapabilities(GLProfile.getDefault()));
        Frame tmpFrame = new Frame();
        tmpFrame.add(tmpCanvas);
        tmpFrame.setVisible(true);

        tmpCanvas.getContext().makeCurrent();
        GL gl = tmpCanvas.getGL();

        String GL_VENDOR = gl.glGetString(GL.GL_VENDOR);
        Debug.DEBUG("SwingScilabCanvasImpl", "GL_VENDOR=" + GL_VENDOR);
        String GL_RENDERER = gl.glGetString(GL.GL_RENDERER);
        Debug.DEBUG("SwingScilabCanvasImpl", "GL_RENDERER=" + GL_RENDERER);
        String GL_VERSION = gl.glGetString(GL.GL_VERSION);
        Debug.DEBUG("SwingScilabCanvasImpl", "GL_VERSION=" + GL_VERSION);
        // Debug.DEBUG("SwingScilabCanvasImpl", "GL_EXTENSIONS="+gl.glGetString(GL.GL_EXTENSIONS));
        Debug.DEBUG("SwingScilabCanvasImpl", "=======================================");
        // System.getProperties().list(System.err);

        // get maximum axes size
        // RenderingCapabilities.updateMaxCanvasSize(gl);

        tmpCanvas.getContext().release();
        tmpFrame.remove(tmpCanvas);
        tmpFrame.setVisible(false);
        tmpFrame.dispose();
        Debug.DEBUG(
            "SwingScilabCanvasImpl",
            "Testing time = " + (Calendar.getInstance().getTimeInMillis() - lastTime) + "ms");

        noGLJPanel = false;

        // By default disable GLJPanel on Linux
        if (OS_NAME.contains("Linux")) {
          noGLJPanel = true;
          // Linux && NVIDIA
          if (GL_VENDOR.contains("NVIDIA")) {
            noGLJPanel = false;
          }
          // Linux && ATI
          if (GL_VENDOR.contains("ATI")) {
            StringTokenizer stSpace = new StringTokenizer(GL_VERSION, " ");
            StringTokenizer stDot = new StringTokenizer(stSpace.nextToken(), ".");
            int majorVersion = Integer.parseInt(stDot.nextToken());
            int minorVersion = Integer.parseInt(stDot.nextToken());
            int releaseVersion = Integer.parseInt(stDot.nextToken());
            // Only OpenGL version newer than 2.1.7873 works
            // available through ATI 8.8 installer
            // and driver newer than 8.52.3
            Debug.DEBUG(
                "SwingScilabCanvasImpl",
                "majorVersion = "
                    + majorVersion
                    + " minorVersion = "
                    + minorVersion
                    + " releaseVersion = "
                    + releaseVersion);
            if (majorVersion > 2
                || majorVersion == 2 && minorVersion > 1
                || majorVersion == 2 && minorVersion == 1 && releaseVersion >= 7873) {
              noGLJPanel = false;
            }
          }
        }

        if (noGLJPanel) {
          /** Inform the users */
          InterpreterManagement.requestScilabExec(
              String.format(
                  "disp(\"%s\"), disp(\"%s\")",
                  String.format(
                      Messages.gettext(
                          "WARNING: Due to your configuration limitations, Scilab switched in a mode where mixing uicontrols and graphics is not available. Type %s for more information."),
                      "\"\"help usecanvas\"\""),
                  String.format(
                      Messages.gettext("In some cases, %s fixes the issue"),
                      "\"\"system_setproperty(''jogl.gljpanel.nohw'','''');\"\"")));
        }
      } catch (GLException e) {
        noGLJPanel = true;
        /** Inform the users */
        InterpreterManagement.requestScilabExec(
            String.format(
                "disp(\"%s\"), disp(\"%s\")",
                Messages.gettext(
                    "Due to your video card drivers limitations, that are not able to manage OpenGL, Scilab will not be able to draw any graphics. Please update your driver."),
                String.format(
                    Messages.gettext("In some cases, %s fixes the issue"),
                    "\"\"system_setproperty(''jogl.gljpanel.nohw'','''');\"\"")));
      } catch (HeadlessException e) {
        // do not print anything on a CLI only environment
        noGLJPanel = true;
      }
    }
  }