Cross-platform SDK and HTML5 tools for mobile app development
X
 

GLMobletOpenGLES2

This example application demonstrates how to use OpenGL ES 2.0 to control a device's graphics hardware.

GLMoblet_OpenGLES2

This example is included in the MoSync SDK installation in the /OpenGLES/examples folder. For information on importing the examples into your workspace, see Importing the Examples.

Behaviour

When this application is started you will see a trippy pattern moving on the screen.

In the Code

The code of the project is collected in one single file. It shows how to use the GLMoblet in order to create an OpenGL ES 2.0 based application. It has a set of helper functions for loading shaders (‘loadShader’) and checking for errors (‘checkGLError’).

The ‘init’ function first calls initGL which loads the vertex and fragment shader, sets up the default state and maps variables to the uniforms of the shader. In the ‘draw’ function, the uniforms that contain the current time in seconds and the multiplicative inverse for the screen resolution, are updated and a triangle fan that covers the entire screen are drawn.

The shader is set to be used so the shader program will run for each pixel on the screen. The shader generates a pattern by calculating colors as a function of time, x and y coordinates.

Touch Responses

  • Tap buttons to capture image, switch screens, zoom in/out.

 

Doesn't work on HTC Desire HD emulator

Hi .Tried to run this demo .Using HTC Desire HD emulator.I am getting the message from the emulator that it doesn't have OpenGL ES installed or it is incompatible .Another demo using ES1 runs fine. Any clue on what is wrong here ?

Thanks .

Edit:
Well I think I found the answer on Google Android site:

Caution: OpenGL ES 2.0 is currently not supported by the Android Emulator. You must have a physical test device running Android 2.2 (API Level 8) or higher in order to run and test the example code in this tutorial.

Cause crash

The exemple works perfectly fine when running on my HTC Sensation. Problem is, when I close the app (actually when I leave it by pressing the home button), screen freez, nomo input, big crash (the kind of crash that needs you to pull out the battery...) I ain't got any clue what's causing that.

HTC Sensation
Build: Virtuous Inquisition v4.0.2
Bootloader: 1.27.1100
Kernel: Linux version 3.0.16-v1.4.1 (gcc version 4.4.3)

Penumbra, Android v4.0.2

Penumbra, platform support is shown in our Feature/Platform Support Matrix. We are aiming for backward compatibility for 4.0.2 only at this time, but that meas the example should work without problem I think, therefore:

reported to the issue tracker as MOSYNC-2337.

Hi, There is a know problem

Hi,
There is a known problem of OpenGl on Android 4.x as MoSync, at the moment, doesn't support OpenGL on this specific platform. Android devices, however, are meant to be backward compatible. MoSync aims to release an Android 4.x runtime in near future. Stay tuned!

Update on the issue

tried to reproduce it on 2 different devices:

Samsung Galaxy s11 running on v4.0.2
can't reproduce the problem

Sony Xperia S running on v4.0.4
and successfully reproduced the problem. However, i found that once you try to hard-reset the phone, the phone gets back to life and starts working. not a fix to the problem though.
Maybe you can also try and see if that works.
Cheers,

You can also follow the

You can also follow the progress here
http://jira.mosync.com/browse/MOSYNC-2337

reproduced on Acer

hi. Same problem i got it on Acer Mobile Cloud S500, with 4.0.4.