Forums - How can I get OpenGL ES2.0 surface?

3 posts / 0 new
Last post
How can I get OpenGL ES2.0 surface?
Kazuhiko_Kobayashi
Join Date: 14 Feb 12
Posts: 9
Posted: Thu, 2012-06-07 04:46

Hi,

I'm developing Live Wallpaper using OpenGL ES2.0 for Android.

The prototype works fine on Adreno205.

However, it doesn't work on Adreno200.

I can't get EGLSurface on Adreno200.

 

       int[] configAttribs = {
           EGL10.EGL_RED_SIZE, 8,
           EGL10.EGL_GREEN_SIZE, 8,
           EGL10.EGL_BLUE_SIZE, 8,
           EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
           EGL10.EGL_NONE
       };

           egl.eglChooseConfig(display, configAttribs, configs,
numConfigs, num_config);

  

It works,but eglCreateWindowSurface always returns "EGL10.EGL_NO_SURFACE".

When I removed this line:

           EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,

eglCreateWindowSurface returns surface, but OpenGL ES2.0 doesn't work with it.
I want to use OpengGL ES2.0 in Live Wallpaper.
Please help.
Test machine:
    SHARP SH-03C
    Android 2.2.2
Thanks.
  • Up0
  • Down0
Zbigniew_Polito
Join Date: 5 Feb 12
Posts: 5
Posted: Fri, 2012-06-15 15:16

use 565 format, or write proper config chooser checking for available surface format, 888 can crash some devices, and as far as i know safest choice is 565, there are some nice examples on how to achieve this, just search for configchooser.

  • Up0
  • Down0
dr.frank.stain@...
Join Date: 4 Apr 12
Posts: 7
Posted: Sun, 2012-07-01 22:44

Hi, Kazuhiko.

It seems that you choose some incompatible config. It may be a RGBX (8880)  config, that not supported at most devices.

Are you set the surface pixel format when SurfaceView is created? ( SurfaceView.getHolder().setFormat( PixelFormat.### ); )

You need to do some steps if you want to create egl window surfaces on all devices without problems.

1. Set the surface pixel format (  setFormat( PixelFormat.### )  ) when SurfaceView is created. Android support says that it's not necessary now, but they lie. :)

2. Choose compatible egl config. If you set RGBA_8888 pixel format, that you need to choose 8888 config. If pixel format is RGB_565, that config must be 565. You need to set size of all color channels and it will better if you set buffer size attrib to.

3. EGL_NATIVE_VISUAL_ID attrib of choosed config must be identical as choosed pixel format or 0. It will much better if you set this attrib to.

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.