0

I'm working on this browser in JavaFX. However.. When you visit a page that is using WebGL, the page loads but is extremely choppy and basically unusable.

So the question is, how would I increase the performance of a webpage using WebGL so the users can navigate the page smoothly?

Here's my demonstration

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

  public final class App extends Application {

  @Override
  public void start(Stage stage) throws Exception {
        Group group = new Group();           
        WebView browser = new WebView();            
        WebEngine engine = browser.getEngine(); 

        engine.load("http://rune.tools/");

        group.getChildren().add(browser);

        Scene scene = new Scene(group, Color.BLACK);

        stage.setScene(scene);            
        stage.setTitle("JavaFX WebGL");            
        stage.centerOnScreen();
        stage.sizeToScene();   
        stage.setResizable(false);            
        stage.show();
  }

  public static void main(String[] args) {
        launch(args);
  }

  }
gman
  • 100,619
  • 31
  • 269
  • 393
  • It runs pretty slow on my laptop too. JavaFx uses Rhino right? And Unity produces emscripten output. I think the problem is with the javascript, not with the graphics. Why would you embed a unity program in javafx? why dont you just use the mono bundler? – Tamas Hegedus May 10 '16 at 22:14
  • No, [JavaFX does not use Rhino](http://stackoverflow.com/questions/30104124/what-javascript-engine-used-inside-javafx). – jewelsea May 10 '16 at 22:16

1 Answers1

1

JavaFX 8 doesn't support WebGL, so you can't increase WebGL performance of JavaFX, because it has nothing to increase.

jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • Well that's unfortunate, think they'll add it in Java 9? –  May 10 '16 at 22:22
  • No, I don't think this feature will be added to Java 9. You can check the JavaFX component in the [openjdk bug database] to see if the feature is already requested. You can [create a new feature request](http://bugreport.java.com) or open a discussion for a new feature request on the [JavaFX developer mailing list](http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev). – jewelsea May 10 '16 at 22:32
  • 2
    After some research, I found you might be able to embedd [Chromium](https://code.google.com/archive/p/javachromiumembedded/) in Java which will allow for WebGL. –  May 11 '16 at 19:33