Zahema
Zahema

Reputation: 1415

How to use threejs with phonegap?

The questing is very self-describing. I have tested with a simple 3D cube. it works fine in browser. but just displays a blank page in emulator.

Some says that threejs does not work with phonegap, but some others say they used and it works fine !

Upvotes: 2

Views: 2793

Answers (1)

Morrison Chang
Morrison Chang

Reputation: 12121

In Android you can either use the Chrome app to show your webpage or use phonegap/cordova and used the embedded WebView.

Until Lollipop the default WebView depended on OS updates, now on devices from Lollipop (5.x) and up there is a 'Android System WebView' which is updated.

From this page: https://developer.chrome.com/multidevice/webview/overview You can see that WebGL support wasn't added until WebView v36.

On emulator I don't believe that WebGL is supported in the WebView but you should be able to use it on devices with Lollipop and higher.

EDIT 2015-12-02

One other possibility if you want to use WebGL on Android devices lower than Lollipop (5.x) you could include your own browser component.

The Crosswalk Project would be something to look at to allow for more devices to run your WebGL code.

Do note the WebGL limitations listed here: https://crosswalk-project.org/documentation/about/faq.html#Canvas-and-WebGL-support

Upvotes: 2

Related Questions