Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. WebEngineView: Problem with loading a WebGL project (exported from Unity)
Forum Updated to NodeBB v4.3 + New Features

WebEngineView: Problem with loading a WebGL project (exported from Unity)

Scheduled Pinned Locked Moved Solved QtWebEngine
2 Posts 1 Posters 777 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Avasil
    wrote on last edited by Avasil
    #1

    Hello! I'm trying to download a WebGL project (exported from Unity 2018.3.14f1) in Web Engine View.

    The Qt project was take from Qt's library of examples ("WebEngine Widgets Minimal Example").

    #include <QApplication>
    #include <QWebEngineView>
    
    QUrl commandLineUrlArgument()
    {
        const QStringList args = QCoreApplication::arguments();
        for (const QString &arg : args.mid(1)) {
            if (!arg.startsWith(QLatin1Char('-')))
                return QUrl::fromUserInput(arg);
        }
        return QUrl(QStringLiteral("file:///F:/qt/test4Exp/index.html"));
    }
    
    int main(int argc, char *argv[])
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        QApplication app(argc, argv);
    
        QWebEngineView view;
        view.setUrl(commandLineUrlArgument());
        view.resize(1024, 750);
        view.show();
    
        return app.exec();
    }
    

    The WebGL project was created in Unity 2018 - an empty scene without objects (camera only)...
    Screenshot Unity Project

    ... and exported to the WebGL Assembly (applied .gzip compression, build size 2.3 MB).
    Screenshot Build Setting

    When you open a WebGL project in Chrome, everything loads very quickly (instantly).
    Screenshot Open Chrome

    When you open WebGL in Web Engine View, the project takes a very long time to load (about 5-6 minutes).
    Screenshot Loading WebGL in WebEngineView
    Screenshot Loaded WebGL in WebEngineView

    The WebGL project is opened from a local drive. I have tried various options for unity export parameters (brodil compression, code optimization, etc.). Tell me, what could be the problem? Can be applied to any option in the Assembly or in QCoreApplication::setAttribute ? Help please...

    Below attached the project WebGL and Qt project
    WebGL Project
    Qt Project

    A 1 Reply Last reply
    0
    • A Avasil

      Hello! I'm trying to download a WebGL project (exported from Unity 2018.3.14f1) in Web Engine View.

      The Qt project was take from Qt's library of examples ("WebEngine Widgets Minimal Example").

      #include <QApplication>
      #include <QWebEngineView>
      
      QUrl commandLineUrlArgument()
      {
          const QStringList args = QCoreApplication::arguments();
          for (const QString &arg : args.mid(1)) {
              if (!arg.startsWith(QLatin1Char('-')))
                  return QUrl::fromUserInput(arg);
          }
          return QUrl(QStringLiteral("file:///F:/qt/test4Exp/index.html"));
      }
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QApplication app(argc, argv);
      
          QWebEngineView view;
          view.setUrl(commandLineUrlArgument());
          view.resize(1024, 750);
          view.show();
      
          return app.exec();
      }
      

      The WebGL project was created in Unity 2018 - an empty scene without objects (camera only)...
      Screenshot Unity Project

      ... and exported to the WebGL Assembly (applied .gzip compression, build size 2.3 MB).
      Screenshot Build Setting

      When you open a WebGL project in Chrome, everything loads very quickly (instantly).
      Screenshot Open Chrome

      When you open WebGL in Web Engine View, the project takes a very long time to load (about 5-6 minutes).
      Screenshot Loading WebGL in WebEngineView
      Screenshot Loaded WebGL in WebEngineView

      The WebGL project is opened from a local drive. I have tried various options for unity export parameters (brodil compression, code optimization, etc.). Tell me, what could be the problem? Can be applied to any option in the Assembly or in QCoreApplication::setAttribute ? Help please...

      Below attached the project WebGL and Qt project
      WebGL Project
      Qt Project

      A Offline
      A Offline
      Avasil
      wrote on last edited by
      #2

      The problem was solved after running the application from under exe file (not from under QtCreator).Everything works faster under exe file. Apparently the launch and initialization of the Unity engine is slowed down by QtCreator. When the application is running under exe web project launch in Web Engine View takes 2-3 seconds (on an old PC 7-9 seconds).

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved