Samsung Galaxy odd OGL ES hardware acceleration [RESOLVED]

Problems with Canvas, OpenGL, etc...

Postby zorro » Wed Jan 13, 2010 2:28 pm

To load textures I use
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
  2.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

not the default GL10.texImage2D. I don't know which is better. The version from GLutils handles the format itself detecting the bitmap so I don't have to specify if it's 8888 or 565. But I'm wondering if that can be the cause of the problem...
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Top

Postby fabrantes » Wed Jan 13, 2010 3:35 pm

zorro wrote:To load textures I use
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
  2.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

not the default GL10.texImage2D. I don't know which is better. The version from GLutils handles the format itself detecting the bitmap so I don't have to specify if it's 8888 or 565. But I'm wondering if that can be the cause of the problem...


Im using this piece of code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     private void bindTexture(GL10 gl, Bitmap bitmap, int textureId){
  2.         /** bind new texture */
  3.         gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);
  4.        
  5.         gl.glTexParameterf(
  6.                         GL10.GL_TEXTURE_2D,
  7.                         GL10.GL_TEXTURE_MIN_FILTER,
  8.                 GL10.GL_LINEAR);
  9.         gl.glTexParameterf(
  10.                         GL10.GL_TEXTURE_2D,
  11.                 GL10.GL_TEXTURE_MAG_FILTER,
  12.                 GL10.GL_LINEAR);
  13.  
  14.         gl.glTexParameterf(
  15.                         GL10.GL_TEXTURE_2D,
  16.                         GL10.GL_TEXTURE_WRAP_S,
  17.                 GL10.GL_CLAMP_TO_EDGE);
  18.         gl.glTexParameterf(
  19.                         GL10.GL_TEXTURE_2D,
  20.                         GL10.GL_TEXTURE_WRAP_T,
  21.                 GL10.GL_CLAMP_TO_EDGE);
  22.        
  23. //        gl.glTexParameterf(
  24. //                      GL10.GL_TEXTURE_2D,
  25. //                      GL10.GL_TEXTURE_COLOR_BORDER,
  26. //                GL10.GL_NICEST);
  27.  
  28.         gl.glTexEnvf(
  29.                         GL10.GL_TEXTURE_ENV,
  30.                         GL10.GL_TEXTURE_ENV_MODE,
  31.                         GL10.GL_MODULATE);
  32. //                      GL10.GL_DECAL);
  33. //                      GL10.GL_MODULATE);
  34. //                      GL10.GL_BLEND);
  35. //                GL10.GL_REPLACE);
  36.  
  37.  
  38.         if(bitmap != null)
  39.                 GLUtils.texImage2D(
  40.                                 GL10.GL_TEXTURE_2D,
  41.                                 0,
  42.                                 bitmap,
  43.                                 0);
  44.  
  45.     }
  46.  
Parsed in 0.046 seconds, using GeSHi 1.0.8.4
fabrantes
Developer
Developer
 
Posts: 25
Joined: Fri Sep 05, 2008 3:13 pm

Postby zorro » Wed Jan 13, 2010 3:42 pm

I'm using something similar. I am sure that my problems on Droid are caused by EGL config because as soon as I removed the lines, one user told me that the game works on Nexus One with android 2.1. With EGL the game was not working at all.

I'm not saying that using EGL is bad, just that I didn't find an all-in-one config for all the Android phones. Plus the fact that in Android 2.0 the EGL config reader (built in the OS) is done right so you need to specify the correct order of the parameters (in Android 1.1 - 1.6 the read function was broken and the parameteres are readed in reverse order) which is, in my opinion, another reason to avoid EGL config for now.
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Postby jsemler » Wed May 12, 2010 6:42 am

zorro wrote:I'm using MODULATE as well for textures. If you are using EGL for Droid, what config are you requesting. I used to request a 24 bit zbuffer but users complained about 'ghosting'. Then i used explicitly a RGB565 with Z24 but users complained now that the app was not starting at all (crash at init). I don't have the phone and that is why I don't know how to make it work I guess.


I believe the Motorola Droid prefers 24 bit depth buffer for hardware acceleration.

I modified the code to return a list of configurations:

Code: Select all
I/MoonClock( 2152): result[0] = 10
I/MoonClock( 2152): Config List {
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,5,6,5,0>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,5,6,5,0>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,8,8,8,8>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,8,8,8,8>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,8,8,8,8>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <24,8,8,8,8,8>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <16,0,5,6,5,0>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <16,0,8,8,8,0>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <16,0,8,8,8,8>
I/MoonClock( 2152):     <d,s,r,g,b,a> = <16,0,0,0,0,8>
I/MoonClock( 2152): }


Offset is zero relative in the list above.

config[0] and config[1] from the above list is fast.

config[6] is definitely slow.

I believe most of the other configs from the list above crashes the system (I only tried a few).

This is the code I used to get my list of configs.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         mSurfaceView.setEGLConfigChooser(
  2.                 new GLSurfaceView.EGLConfigChooser() {
  3.                      public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
  4.                           int[] attributes=new int[]{
  5.                                EGL10.EGL_DEPTH_SIZE, 16,
  6.                                EGL10.EGL_STENCIL_SIZE, 0,
  7.                                //EGL10.EGL_RED_SIZE, 5,
  8.                                //EGL10.EGL_GREEN_SIZE, 6,
  9.                                //EGL10.EGL_BLUE_SIZE, 5,
  10.                                //EGL10.EGL_ALPHA_SIZE, 0,
  11.                                EGL10.EGL_NONE
  12.                           };
  13.                           int[] numConfig = new int[1];
  14.                           egl.eglChooseConfig(display, attributes, null, 0, numConfig);
  15.                           EGLConfig[] configs=new EGLConfig[numConfig[0]];
  16.                           int[] result=new int[1];
  17.                           egl.eglChooseConfig(display, attributes, configs, numConfig[0], result);
  18.                           Log.i(TAG, "result[0] = " + result[0]);
  19.                           listConfig(egl, display, configs);
  20.                           return configs[6];
  21.                      }
  22.                 });
  23.  
  24. ...
  25. ...
  26. ...
  27.     private int getConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute) {
  28.         int[] value = new int[1];
  29.         return egl.eglGetConfigAttrib(display, config,
  30.                         attribute, value)? value[0] : 0;
  31.     }
  32.  
  33.     private void listConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs) {
  34.         Log.i(TAG, "Config List {");
  35.  
  36.         for (EGLConfig config : configs) {
  37.             int d, s, r, g, b, a;
  38.                    
  39.             // Expand on this logic to dump other attributes
  40.             d = getConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE);
  41.             s = getConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE);
  42.             r = getConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE);
  43.             g = getConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE);
  44.             b = getConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE);
  45.             a = getConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE);
  46.             Log.i(TAG, "    <d,s,r,g,b,a> = <" + d + "," + s + "," +
  47.                 r + "," + g + "," + b + "," + a + ">");
  48.         }
  49.  
  50.         Log.i(TAG, "}");
  51.     }
  52.  
Parsed in 0.049 seconds, using GeSHi 1.0.8.4
jsemler
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 18, 2010 3:53 pm

Postby zorro » Wed May 12, 2010 7:01 am

I see you request EGL10.EGL_DEPTH_SIZE to be 16, but you said that the best way is to select a 24 bit zbuffer.
Are you using the same initialization for 1.5-1.6 devices as well? I was searching for an unique initialization for all Android devices, and to be the fastest configuration too on every device. It is possible?
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Postby jsemler » Wed May 12, 2010 7:10 am

zorro wrote:I see you request EGL10.EGL_DEPTH_SIZE to be 16, but you said that the best way is to select a 24 bit zbuffer.
Are you using the same initialization for 1.5-1.6 devices as well? I was searching for an unique initialization for all Android devices, and to be the fastest configuration too on every device. It is possible?


I only have one physical hardware device - the Motorola Droid.

The first one in the list is 24 bit even if I specified 16 bit depth! If I set requested number of configs to one, I still get the same results. If I do nothing special, I get the hardware acceleration by default. I normally don't choose my Config, I let GLSurfaceView do the work.

That logic does not seem to discriminate against Motorola Droids.
jsemler
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 18, 2010 3:53 pm

Top

Postby zorro » Wed May 12, 2010 7:18 am

My real problem is not with initialization.. after all. I guess the init goes ok (I don't have the device). But users complain about 'ghosting' in the game. I have 2 overlapping layers in the game (it's a 2d game) and it seems that the background texture does not load properly. Can you tell me how you load your textures? I load the bitmap and then convert it to a new bitmap (RGB565 if it has no alpha or RGBA444 if it has alpha) and then i create the texture.. But everything i tried does not solve my problem.. it's a real nightmare this droid.. on other phones, including Nexus with 2.1 it works well.
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Postby jsemler » Wed May 12, 2010 3:32 pm

I don't do any explicit conversion. The texture file is in ".PNG" format.

FWIW, I don't use the command "glDisable(GL_DITHER)". It makes bright-rayed craters look unnatural on the "night side" of the Moon I'm modelling. Maybe this is the cause of the Ghosting? (I don't know what people are seeing).

Here's the relevant pieces of the code I'm using:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. ...
  3.  
  4. ...
  5.  
  6. ...
  7.  
  8. public class Rendering implements GLSurfaceView.Renderer {
  9.  
  10. ...
  11.  
  12. ...
  13.  
  14. ...
  15.  
  16.     private Spheroid mMoonModel;
  17.  
  18. ...
  19.  
  20. ...
  21.  
  22. ...
  23.  
  24.     public void onSurfaceCreated(GL10 gl, EGLConfig config) {
  25.  
  26.         /*
  27.  
  28.          * Some one-time OpenGL initialization can be made here
  29.  
  30.          * probably based on features of this particular context
  31.  
  32.          */
  33.  
  34.         glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
  35.  
  36.  
  37.  
  38.         glClearColor(0, 0, 0, 0);
  39.  
  40.         glShadeModel(GL_SMOOTH);
  41.  
  42.         glEnable(GL_DEPTH_TEST);
  43.  
  44.         glEnable(GL_TEXTURE_2D);
  45.  
  46.  
  47.  
  48.         /*
  49.  
  50.          * Create our texture. This has to be done each time the
  51.  
  52.          * surface is created.
  53.  
  54.          */
  55.  
  56.         int[] textures = new int[1];
  57.  
  58.         glGenTextures(1, textures, 0);
  59.  
  60.         mTextureID = textures[0];
  61.  
  62.         glBindTexture(GL_TEXTURE_2D, mTextureID);
  63.  
  64.         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  65.  
  66.         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  67.  
  68.         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  69.  
  70.         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  71.  
  72.         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
  73.  
  74.         GLUtils.texImage2D(GL_TEXTURE_2D, 0, mMoonModel.getBitmap(), 0);
  75.  
  76.  
  77.  
  78.         init(gl);
  79.  
  80.     }
  81.  
  82. ...
  83.  
  84. ...
  85.  
  86. ...
  87.  
  88. }
  89.  
  90.  
  91.  
  92.  
  93.  
  94. ...
  95.  
  96. ...
  97.  
  98. ...
  99.  
  100. public class Spheroid extends Shape {
  101.  
  102. ...
  103.  
  104. ...
  105.  
  106. ...
  107.  
  108.     public void setTextureResource(Context context, int textureResourceId) {
  109.  
  110.         InputStream is = context.getResources().openRawResource(textureResourceId);
  111.  
  112.         mBitmap = BitmapFactory.decodeStream(is);
  113.  
  114.  
  115.  
  116.         try {
  117.  
  118.             is.close();
  119.  
  120.         }
  121.  
  122.         catch(IOException e) {
  123.  
  124.             // Ignore.
  125.  
  126.         }
  127.  
  128.     }
  129.  
  130. ...
  131.  
  132. ...
  133.  
  134. ...
  135.  
  136.     public Bitmap getBitmap() {
  137.  
  138.         return mBitmap;
  139.  
  140.     }
  141.  
  142. }
  143.  
  144.  
Parsed in 0.048 seconds, using GeSHi 1.0.8.4
jsemler
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 18, 2010 3:53 pm

Re: Samsung Galaxy odd OGL ES hardware acceleration [RESOLVE

Postby Jenniffer » Fri May 31, 2013 7:40 am

Although I am not as technically sound as the others, but I would suggest that you must not load your phone with too many applications. Secondly, try bringing the customer care cell into notice, they might provide suitable answer to your questions.
Jenniffer
Once Poster
Once Poster
 
Posts: 1
Joined: Fri May 31, 2013 7:29 am

Re: Samsung Galaxy odd OGL ES hardware acceleration [RESOLVE

Postby dipzee » Tue Sep 10, 2013 12:54 pm

There has been enormous apps and services that are updated here on the Samsung galaxy OGL ES hardware . I would like to make a detailed study on this topic. Please suggest me the tips on new games available.
newagelessmale.com
dipzee
Freshman
Freshman
 
Posts: 7
Joined: Wed Jul 17, 2013 7:18 am

Top
Previous

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 4 guests