Beispiel #1
0
  public static void main(String[] args) {
    GLProfile.initSingleton();

    EventQueue.invokeLater(
        () -> {
          MyFrame f = new MyFrame();
          f.setVisible(true);
        });
  }
Beispiel #2
0
  @Override
  public void run() {
    // // Necessary to load the native libraries correctly (see
    // //
    // http://forum.jogamp.org/Return-of-the-quot-java-lang-UnsatisfiedLinkError-Can-t-load-library-System-Library-Frameworks-glueg-td4034549.html)
    JarUtil.setResolver(
        new JarUtil.Resolver() {

          @Override
          public URL resolve(final URL url) {
            try {
              final URL urlUnescaped = FileLocator.resolve(url);
              final URL urlEscaped =
                  new URI(urlUnescaped.getProtocol(), urlUnescaped.getPath(), null).toURL();
              return urlEscaped;
            } catch (final IOException ioexception) {
              return url;
            } catch (final URISyntaxException urisyntaxexception) {
              return url;
            }
          }
        });

    // Necessary to initialize very early because initializing it
    // while opening a Java2D view before leads to a deadlock
    GLProfile.initSingleton();
    while (!GLProfile.isInitialized()) {
      try {
        Thread.sleep(100);
      } catch (final InterruptedException e) {
        e.printStackTrace();
      }
    }

    isInitialized = true;
  }
 static {
   // setting this true causes window events not to get sent on Linux if you run from inside
   // Eclipse
   GLProfile.initSingleton();
 }