mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.5k stars 35.21k forks source link

Opera Mobile 12 #1419

Closed renegademaster88 closed 12 years ago

renegademaster88 commented 12 years ago

http://my.opera.com/chooseopera/blog/2012/02/27/opera-mini-7-next-and-opera-mobile-12

Opera Mobile has enabled WebGL for Android, a very exciting new development.

I tried this on my admittedly aging phone, and got their demo + MrDoobs Voxel painter to work.

Unfortunately my more complex software produced unusual results (r46), anyone else tried this with their code?

alteredq commented 12 years ago

Apparently it also runs our geometries example ;)

http://youtu.be/gtDf2AXCPP0?t=48s

renegademaster88 commented 12 years ago

I tried getting WebGL to work in Opera 12.00 on the desktop but no luck there, so kind of hard to debug - although there was a long list of errors. Its a bit strange they got it to work on Android before windows!

mrdoob commented 12 years ago

Apparently it also runs our geometries example ;)

http://youtu.be/gtDf2AXCPP0?t=48s

Haha!

Its a bit strange they got it to work on Android before windows!

Indeed.

alteredq commented 12 years ago

I suspect Android SDK may provide some intermediate layer for cross-device dealing with OpenGL ES 2.0, so this could make it easier to implement WebGL.

On desktop, it's Opera vs jungle of multi-platform OpenGL drivers, on Android I guess it's Opera vs Android SDK.

renegademaster88 commented 12 years ago

But if i want my THREE.js based game engine to run on Android, do i have to dig into the SDK to do it then? Is the SDK Java or Python based?

alteredq commented 12 years ago

But if i want my THREE.js based game engine to run on Android, do i have to dig into the SDK to do it then?

Only if you would want to implement your own browser ;)

Is the SDK Java or Python based?

I don't know, it used to be Java only when Android just launched, I didn't look at it since then.

renegademaster88 commented 12 years ago

Ok i well really dont want to that i have enough to do! Of course if i click "internet" on my Android phone i am really using some sort of Chrome derived browser right? So the big question when is THAT going to support WebGL ???

I know the Sony Experia phone supports WebGL, did they have to write some sort of Android SDK plugin? Those nice at Sony guys made the project open source too!

mrdoob commented 12 years ago

I think it will support WebGL. A matter of time. Right now Firefox and Opera for Android support WebGL. I've been trying our examples in both browsers. Some things work some doesn't. I suspect some things are about textures being too large. It just needs some testing time.

But yes, in a matter of months your game should run on any browser in your Android phone. And some months later on your iPhone or iPad.

alteredq commented 12 years ago

@mrdoob Did you see this at FITC?

http://www.youtube.com/watch?v=ZgLbjva4O2o

https://twitter.com/#!/thibault_imbert/status/174639265752416259

If Stage3D runs well there, I think WebGL should also.

mrdoob commented 12 years ago

I didn't, I was doing a talk about demoscene and stuff at the same time of the keynote :)

Yep, I'm pretty sure WebGL will run fine. But it will need to be done with the mobile platform in mind. I'm pretty sure these effects were not just working on mobile magically and required some level of optimisation.

alteredq commented 12 years ago

Here is behind-the-scenes post about APEXvj:

http://www.simppa.fi/blog/apexvj_the_new_epoch/

Some tips about mobile performance optimizations (I'll try to translate it into terms of our API):

  • don't use alphaTest, instead use additive blending
  • matrix calculations in shader are expensive, don't orient particles towards camera, instead try to construct scene in a way that camera looks at them right most of time (for us this would be about Sprites, ParticleSystems get this by GPU, I wonder about the performance)
  • render into texture of fixed size then resize this to match device screen size
  • avoid use of functions calls, these are expensive
  • don't handle mouse, just touch events