Xperia™ phones first to support WebGL™

In the latest software upgrade  we did for the 2011 Xperia™ phones, we’ve included WebGL™ support. By doing so, Sony Ericsson is the first mobile phone manufacturer to support WebGL for the Android web browser. WebGL basically makes it possible to extend the capability of the JavaScript programming language to allow it to generate interactive 3D graphics within the web browser. Read more about Sony Ericsson’s WebGL support after the jump, and find out about special considerations to keep in mind when developing 3D web applications targeting touch-enabled devices.

In this article, Anders Isberg from Sony Ericsson’s Technology Reseach department explains more about WebGL and what to think of when you develop 3D web applications for touch-enabled devices. If you scroll down, you will also find three WebGL examples that you can browse to from the Android browser, if you have the latest software on your 2011 Xperia™ phone. You can also check out how it looks in the video above.

***

Earlier this year, I made a blog post about an internal WebGL research project  on how WebGL could be implemented in phones. Based on the feedback we received back then, we decided to launch support for WebGL in the latest software upgrade  we rolled out for the 2011 Xperia™ phones during this autumn and winter. Now let’s take a closer look at what WebGL support means for mobile.

Anders Isberg, Sony Ericsson.

What is required to implement a WebGL application?
Unlike other 3D web technologies, WebGL will not require any plug-in modules. Once the device is WebGL enabled, no further installations are required, and developers can go ahead and explore the WebGL™ functionality. To learn how to develop WebGL applications, we recommend visiting one of the following online resources that gives an introduction on WebGL application development, for example, Learning WebGL or the Khronos WebGL Tutorial.

Due to the fact that WebGL is a low level API, the technical threshold is rather high if you are new to developing WebGL applications. However, there is no reason to be scared by this. There are several JavaScript frameworks available that make it easier to create WebGL applications. Several of these can be found on the Khronos WebGL Wiki.

Navigating and interacting with 3D web applications
Most of the existing WebGL applications available on the web are tailored for a desktop environment. Consequently, those applications are making use of the W3C DOM Mouse and Keyboard events to navigate and control the WebGL application. However, on a mobile device, the touch events must be used to navigate and control the 3D scene. The Android web browser supports three basic touch events that can be used to navigate and control the WebGL application:

  • touchstart: generated when the finger is placed on a selected DOM element.
  • touchmove: generated when a finger is moved over a DOM element.
  • touchend: generated when the finger is removed from a DOM element.

The following code example shows how an event listener is assigned to touchmove event on a WebGL accelerated HTML Canvas element:

// Add an event listener on the WebGL™ canvas
webglcanvas.addEventListener('touchmove', onTouchMove);
function onTouchMove (event)
{
    // Cancel the default event handler
    event.preventDefault();
    // Readout the current X and Y coordinate relative the viewport
    var currentX = event.targetTouches[0].clientX;
    var currentY = event.targetTouches[0].clientY;
}

In many cases, the same code used to handle mouse movements can be reused for touch events. There are also frameworks available to simplify the handling of touch events. For example, there is a jQuery plugin that unifies touch and mouse events across platforms, as well as a Mobile jQuery that has support for high level events like swipe.

Considerations when developing for mobile
Devices such as Xperia™ PLAY, Xperia™ arc, Xperia™ neo and Xperia™ pro are equipped with a 1 GHz Snapdragon™ processor and an Adreno™ 205 graphics processor, so even if the processing power is not in parity with desktop computers, there are enough processing capabilities to create astonishing 3D web applications. Check out the video in the beginning to see some examples of WebGL running on a 2011 Xperia™ phone. You can also check out these examples by browsing to them from the Android browser on your 2011 Xperia™ phone, if you have the latest software. Just click one of the links to the demos below. Please be patient while the demos are loading, it might take some time.

When working with WebGL in mobile devices, it is important to take a look under the hood to get good performance. It is essential to consider how the shaders are written, how many polygons that are used in the 3D model, and to select textures carefully. At Developer World, we have published a blog post called Optimising shader performance for the Xperia™ PLAY, which includes several useful tips that can be used to enhance the performance.

One limitation in the Android browser is that web workers are not supported. For some WebGL frameworks that could be a limiting factor. For example, the WebGL framework three.js implements resource loading with web workers. In the WebGL examples listed earlier you can see how this can be solved by using a JavaScript shim layer that emulates web workers. More information about this topic is available at the Google Code Web Workers Emulation project site.

Hopefully this has given you enough information (and confidence!) to get you started with your own WebGL project! Good luck!

Anders Isberg
Master Engineer Technology Research
Sony Ericsson

More information:

Comments 56

Sort by: Newest | Oldest | Most popular

  1. By Rusty Roupell

    #1

    Apps has a music ident , which gives the name of song,ect. Is there a bird call ident. So one can identify a bird by recording its call, Regards, Rusty

  2. Pingback #2

    […]  |  Sony Ericsson  | Email […]

  3. Pingback #3

    […] ที่มา – Sony Ericsson Developer World ผ่าน Xperia Blog หลุดอีก! ภาพ Xperia Nozomi […]

  4. Pingback #4

    […]  |  Sony Ericsson  | Email […]

  5. Pingback #5

    […] – Sony Ericsson Developer World ผ่าน Xperia […]

  6. Pingback #6

    […] – Sony Ericsson Developer World ผ่าน Xperia […]

  7. Pingback #7

    […]  |  Sony Ericsson  | Email this | Comments This entry was posted in News, Technology by […]

  8. Pingback #8

    […]  |  Sony Ericsson  | Email this | Comments admin Posted in Articles No Comments » […]

  9. Pingback #9

    […] 引用来源 | 引用来源 | 此文章网址 | 转寄此文章 | 回应 by admin Published on: 2011 年 11 月 30 日 Comments: No Comments Tags: No Tags Categories:engadget […]

  10. Pingback #10

    […] developer.sonyericsson […]

  11. Pingback #11

    […] Tue, 29 Nov 2011 20:35:00 EDT. Please see our terms for use of feeds. Permalink   |  Sony Ericsson  | Email […]

  12. Pingback #12

    […]  |  Sony Ericsson  | Email […]

  13. Pingback #13

    […] Android 2.3.4 update for Sony Ericsson Xperia devices added WebGL support. [Sony Ericsson] […]

  14. Pingback #14

    […] Android 2.3.4 update for Sony Ericsson Xperia devices added WebGL support. [Sony Ericsson] […]

  15. Pingback #15

    […]  |  Sony Ericsson  | Email this | Comments No Comment var addthis_pub="izwan00"; BOOKMARK […]

Show more comments

1-15 of 56 comments. Show all comments