Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation

2011-11-16 Thread Marcin Mikosik
I've finally got access to Samsung Galaxy s2 GT-i9100 android ver: 2.3.3 (I
also update it to 2.3.5 but problem remained) so can share what I've found:

In my code I draw textures using openg 1.0 in two ways:
- using one glDrawArrays(GL_TRIANGLE_FAN, ...) call for each texture that
is rotated
- using one glDrawTexfOES(...) call for each textures that is not rotated

Experiments showed that usecase that causes problems is when:
* glDrawArrays is used between call to glDrawTexfOES and next call to
eglSwapBuffers(). Such glDrawArrays() call instead of rendering texture
will render rectangle using one color/alpha which will be taken from corner
of texture. If you have texture that has transcluent border (alpha = 0)
then whole rectangle will be invisible, if texture is opaque then rendered
rectangle will be visible and will be drawn using exactly one color.

Digging into details showed that call to glDrawTexfOES() corrupts texture
coordinates array (I set it using glTexCoordPointer() once for the whole
life of opengl context). I use the same texture coordinates for all
textures so there's no need to change once it is set. If I add call
to glTexCoordPointer() before each call to glDrawArrays then everything is
drawn correctly.

Possible workarounds - use cases that work correctly (everything is
rendered properly)
* use only glDrawArrays for rendering textures
* between calls to eglSwapBuffers() sort your calls so all glDrawArrays()
goes first, and glDrawTexfOES() later
* call glTexCoordPointer() before each call to glDrawArrays() that
succeeds glDrawTexfOES()

I'm not opengl expert but it looks like bug in this opengl implementation.
Let me know if I'm wrong.

marcin

On Fri, Sep 9, 2011 at 4:31 PM, Marcin Mikosik marcin.miko...@gmail.comwrote:

 Hi,
 I have the same problem reported by one user of my game (for Galaxy S2).
 Textures that are rotated are either completely invisible or rendered
 incorrectly.

 I use opengl 1.0, without VBO and without mipmapping.
 As I do not have access to galaxy S2 I would be grateful if you post your
 solution once you find it.

 thanks
 marcin

 On Tue, Sep 6, 2011 at 1:03 AM, emanuele padula e.pad...@gmail.comwrote:

 Thank you Christopher. I'll do some test regarding the mipmapping, but
 i'm not sure that it will work. Thank you for you suggestion.


 2011/9/5 Christopher Van Kirk christopher.vank...@gmail.com

 I'm seeing a similar problem on that device, but I haven't spent any
 time looking for an answer yet. I see that you're using VBOs...I've read
 somewhere that some devices have trouble with them but I don't know if it's
 true or which devices might be affected. I also know that in my case I'm
 also using VBOs, but I'm not rotating the texture, I'm stretching it
 without a mipmap, and it's a JPEG.

 Sorry couldn't be more help.


 On 9/5/2011 10:15 PM, pad wrote:

 Hi,
 I have a huge problem ONLY with SAMSUNG GALAXY S2 and i cannot figure
 out if the problem is my code or of this device!!

 ON ALL OTHER PHONES IT WORKS GREAT!!

 I'm Using ONLY OpenGL 1.0.

 The problem is that with the code below my game cannot draw the object
 that need rotation (the objects are not visualized on the screen).
 Objects with no rotation (angle = 0.0) are drawn perfectly.

 ONLY on samsung galaxy s2 the rotated images are not visualized on the
 screen. There is some bug in SG2 that i have to take in cosideration
 or some specific initialization?

 Can you help me???

 Thank you in advance

 public static void drawBitmap(final GL10 gl, final float x, final
 float y,
  final float rotate_x, final float rotate_y, final MyImage m,
 final float angle) {

   // Draw using verts or VBO verts.
   gl.glPushMatrix();
   // gl.glLoadIdentity();

   final int indexPerTile = TextureManager.INDEX_PER_TILE;
   final int indexRow = m.fx.row * TextureManager.INDEX_PER_TILE
 * TextureManager.TILE_PER_ROW;

   if (angle == 0.0f) {

gl.glTranslatef(x, y, 0f);
gl.glScalef(m.scaleWidth, m.scaleHeight, 1);
m.fx.grid.drawStrip(gl, true, indexRow,
 indexPerTile);// the
 code of this method is below

 if (m.alpha != 1 || m.red != 1 || m.blue != 1
 || m.green != 1) {
gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 }

   } else {

  final float xt = rotate_x;
  final float yt = rotate_y;
  gl.glTranslatef(xt, yt, 0f);
  gl.glRotatef(-angle, 0f, 0f, 1.0f);
  gl.glTranslatef(-xt + x, -yt + y, 0f);
  gl.glScalef(m.scaleWidth, m.scaleHeight, 1);

  m.fx.grid.drawStrip(gl, true, indexRow, indexPerTile); // the
 code of this method is below

  if (m.alpha != 1 || m.red != 1 || m.blue != 1 || m.green !=
 1) {
 gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  }
   }

   gl.glPopMatrix();
}


public void drawStrip(final GL10 gl, final boolean

Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation

2011-09-09 Thread Marcin Mikosik
Hi,
I have the same problem reported by one user of my game (for Galaxy S2).
Textures that are rotated are either completely invisible or rendered
incorrectly.

I use opengl 1.0, without VBO and without mipmapping.
As I do not have access to galaxy S2 I would be grateful if you post your
solution once you find it.

thanks
marcin

On Tue, Sep 6, 2011 at 1:03 AM, emanuele padula e.pad...@gmail.com wrote:

 Thank you Christopher. I'll do some test regarding the mipmapping, but i'm
 not sure that it will work. Thank you for you suggestion.


 2011/9/5 Christopher Van Kirk christopher.vank...@gmail.com

 I'm seeing a similar problem on that device, but I haven't spent any time
 looking for an answer yet. I see that you're using VBOs...I've read
 somewhere that some devices have trouble with them but I don't know if it's
 true or which devices might be affected. I also know that in my case I'm
 also using VBOs, but I'm not rotating the texture, I'm stretching it without
 a mipmap, and it's a JPEG.

 Sorry couldn't be more help.


 On 9/5/2011 10:15 PM, pad wrote:

 Hi,
 I have a huge problem ONLY with SAMSUNG GALAXY S2 and i cannot figure
 out if the problem is my code or of this device!!

 ON ALL OTHER PHONES IT WORKS GREAT!!

 I'm Using ONLY OpenGL 1.0.

 The problem is that with the code below my game cannot draw the object
 that need rotation (the objects are not visualized on the screen).
 Objects with no rotation (angle = 0.0) are drawn perfectly.

 ONLY on samsung galaxy s2 the rotated images are not visualized on the
 screen. There is some bug in SG2 that i have to take in cosideration
 or some specific initialization?

 Can you help me???

 Thank you in advance

 public static void drawBitmap(final GL10 gl, final float x, final
 float y,
  final float rotate_x, final float rotate_y, final MyImage m,
 final float angle) {

   // Draw using verts or VBO verts.
   gl.glPushMatrix();
   // gl.glLoadIdentity();

   final int indexPerTile = TextureManager.INDEX_PER_TILE;
   final int indexRow = m.fx.row * TextureManager.INDEX_PER_TILE
 * TextureManager.TILE_PER_ROW;

   if (angle == 0.0f) {

gl.glTranslatef(x, y, 0f);
gl.glScalef(m.scaleWidth, m.scaleHeight, 1);
m.fx.grid.drawStrip(gl, true, indexRow,
 indexPerTile);// the
 code of this method is below

 if (m.alpha != 1 || m.red != 1 || m.blue != 1 ||
 m.green != 1) {
gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 }

   } else {

  final float xt = rotate_x;
  final float yt = rotate_y;
  gl.glTranslatef(xt, yt, 0f);
  gl.glRotatef(-angle, 0f, 0f, 1.0f);
  gl.glTranslatef(-xt + x, -yt + y, 0f);
  gl.glScalef(m.scaleWidth, m.scaleHeight, 1);

  m.fx.grid.drawStrip(gl, true, indexRow, indexPerTile); // the
 code of this method is below

  if (m.alpha != 1 || m.red != 1 || m.blue != 1 || m.green !=
 1) {
 gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  }
   }

   gl.glPopMatrix();
}


public void drawStrip(final GL10 gl, final boolean useTexture,
 final int startIndex,
  final int indexCount) {
   int count = indexCount;
   if (startIndex + indexCount= this.mIndexCount) {
  count = this.mIndexCount - startIndex;
   }

   gl.glDrawElements(GL10.GL_**TRIANGLES, count,
 GL10.GL_UNSIGNED_SHORT,
this.mIndexBuffer.position(**startIndex));

}



  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Display.getRotation() incompatible with accelerometer data

2011-06-14 Thread Marcin Mikosik
I exchanged emails with producer of this tablet and service person
acknowledged that's a bug in its firmware. They are not planning any
fixes/updates.
Based on that I claimed my money back in store where I originally bought
this device.


On Thu, Jun 9, 2011 at 10:45 AM, Marcin Mikosik marcin.miko...@gmail.comwrote:

 Yes, it has android market preinstalled. It also has google maps, youtube,
 gmail apps preinstalled.
 The package box it was sold in has android logo on every side.



Concerning GPS I misread Android 2.2 Compatibility Definition. It says
... each compatible device *should* provide GPS receiver Which means
that it is recommended not required to have GPS.


 I accidentally skimmed through Android 2.2 Compatibility Definition today
 and found out that each compatible device should provide GPS receiver - this
 device does not have one. I installed
 https://market.android.com/details?id=com.chartcross.gpstestfeature=search_result
  that
 works correctly on my Nexus-One but fails on go-clever s73 tab with
 force-close, message from logcat says:
 Caused by: java.lang.IllegalArgumentException: provider=gps
 E/AndroidRuntime( 2657): at
 android.os.Parcel.readException(Parcel.java:1251)
 ..


 I guess we are reaching conclusion that this device is not android
 compatible device which brings a few important questions:
 - How an ordinary user can make sure that a device she/he is going to buy
 is actually 'android compatible device'? Is it some kind of android logo on
 package box or some specific textual declaration from manufacturer? So far I
 thought that presence of android market is enough as one of its
 prerequisites is to pass CCD compatibility tests.
 - As this device contains android market but fails to implement android API
 it will inevitably cause many of its users to rate low many applications
 that won't work correctly on such devices. How is google protecting
 developers/users from such situations?

 thanks
 marcin


 On Wed, Jun 8, 2011 at 9:36 AM, Dianne Hackborn hack...@android.comwrote:

 Are you sure this is an actual Android compatible device?  Does it have
 Market on it (and thus compatible per the CDD)?  If not, there is no telling
 what kinds of incompatibilities there are.


 On Tue, Jun 7, 2011 at 10:44 PM, Marcin Mikosik marcin.miko...@gmail.com
  wrote:

 *
 GoClever tab s73 *
 http://www.goclever.com/en/tablet/360-GOCLEVER-TAB-S73-.html
 Model number: MID_Serails
 Android version 2.2
 Kernel version: 2.6.32.9 MID Serials #1518 Wed Apr 6 16:09:52 CST 2011
 Build Number: MID Serilas 2.2 FRF91 20110402.171535


 On Wed, Jun 8, 2011 at 5:10 AM, Dianne Hackborn hack...@android.comwrote:

 Which device is this?

 On Tue, Jun 7, 2011 at 1:32 AM, Marcin Mikosik 
 marcin.miko...@gmail.com wrote:

 Hi,

 I'm experimenting with newly bought android tablet and found out that
 android API it provides does not comply with android API
 documentation/specification.
 Specifically Display.getRotation() and Accelerometer readings returns
 values that contradicts each other.

 For example:
 running application that has android:screenOrientation=landscape and
 quering Display.getRotation() returns Surface.ROTATION_0 which means this
 tablet is landscape-default device as described in
 http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

 Still, when running the same application and holding device in
 landscape orientation in front of me, I get accelerometer reading that 
 says
 something around: X=10, Y=0 which is clearly wrong because accelerometer
 coordinate system should be aligned with device default orientation
 (landscape in this case). According to blogpost mentioned above - when I
 keep device in its default-orientation (which is landscape in this case) I
 should get accelerometer reading X=0, Y=10.

 Can anybody suggest what's wrong here?
 Either my device is broken or its software has a bug or I misunderstood
 the API semantics (?)

 thanks
 Marcin

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http

Re: [android-developers] Display.getRotation() incompatible with accelerometer data

2011-06-09 Thread Marcin Mikosik
Yes, it has android market preinstalled. It also has google maps, youtube,
gmail apps preinstalled.
The package box it was sold in has android logo on every side.

I accidentally skimmed through Android 2.2 Compatibility Definition today
and found out that each compatible device should provide GPS receiver - this
device does not have one. I installed
https://market.android.com/details?id=com.chartcross.gpstestfeature=search_result
that
works correctly on my Nexus-One but fails on go-clever s73 tab with
force-close, message from logcat says:
Caused by: java.lang.IllegalArgumentException: provider=gps
E/AndroidRuntime( 2657): at
android.os.Parcel.readException(Parcel.java:1251)
..


I guess we are reaching conclusion that this device is not android
compatible device which brings a few important questions:
- How an ordinary user can make sure that a device she/he is going to buy is
actually 'android compatible device'? Is it some kind of android logo on
package box or some specific textual declaration from manufacturer? So far I
thought that presence of android market is enough as one of its
prerequisites is to pass CCD compatibility tests.
- As this device contains android market but fails to implement android API
it will inevitably cause many of its users to rate low many applications
that won't work correctly on such devices. How is google protecting
developers/users from such situations?

thanks
marcin


On Wed, Jun 8, 2011 at 9:36 AM, Dianne Hackborn hack...@android.com wrote:

 Are you sure this is an actual Android compatible device?  Does it have
 Market on it (and thus compatible per the CDD)?  If not, there is no telling
 what kinds of incompatibilities there are.


 On Tue, Jun 7, 2011 at 10:44 PM, Marcin Mikosik 
 marcin.miko...@gmail.comwrote:

 *
 GoClever tab s73 *
 http://www.goclever.com/en/tablet/360-GOCLEVER-TAB-S73-.html
 Model number: MID_Serails
 Android version 2.2
 Kernel version: 2.6.32.9 MID Serials #1518 Wed Apr 6 16:09:52 CST 2011
 Build Number: MID Serilas 2.2 FRF91 20110402.171535


 On Wed, Jun 8, 2011 at 5:10 AM, Dianne Hackborn hack...@android.comwrote:

 Which device is this?

 On Tue, Jun 7, 2011 at 1:32 AM, Marcin Mikosik marcin.miko...@gmail.com
  wrote:

 Hi,

 I'm experimenting with newly bought android tablet and found out that
 android API it provides does not comply with android API
 documentation/specification.
 Specifically Display.getRotation() and Accelerometer readings returns
 values that contradicts each other.

 For example:
 running application that has android:screenOrientation=landscape and
 quering Display.getRotation() returns Surface.ROTATION_0 which means this
 tablet is landscape-default device as described in
 http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

 Still, when running the same application and holding device in landscape
 orientation in front of me, I get accelerometer reading that says something
 around: X=10, Y=0 which is clearly wrong because accelerometer coordinate
 system should be aligned with device default orientation (landscape in this
 case). According to blogpost mentioned above - when I keep device in its
 default-orientation (which is landscape in this case) I should get
 accelerometer reading X=0, Y=10.

 Can anybody suggest what's wrong here?
 Either my device is broken or its software has a bug or I misunderstood
 the API semantics (?)

 thanks
 Marcin

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me

[android-developers] Display.getRotation() incompatible with accelerometer data

2011-06-07 Thread Marcin Mikosik
Hi,

I'm experimenting with newly bought android tablet and found out that
android API it provides does not comply with android API
documentation/specification.
Specifically Display.getRotation() and Accelerometer readings returns values
that contradicts each other.

For example:
running application that has android:screenOrientation=landscape and
quering Display.getRotation() returns Surface.ROTATION_0 which means this
tablet is landscape-default device as described in
http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

Still, when running the same application and holding device in landscape
orientation in front of me, I get accelerometer reading that says something
around: X=10, Y=0 which is clearly wrong because accelerometer coordinate
system should be aligned with device default orientation (landscape in this
case). According to blogpost mentioned above - when I keep device in its
default-orientation (which is landscape in this case) I should get
accelerometer reading X=0, Y=10.

Can anybody suggest what's wrong here?
Either my device is broken or its software has a bug or I misunderstood the
API semantics (?)

thanks
Marcin

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Display.getRotation() incompatible with accelerometer data

2011-06-07 Thread Marcin Mikosik
*
GoClever tab s73 *
http://www.goclever.com/en/tablet/360-GOCLEVER-TAB-S73-.html
Model number: MID_Serails
Android version 2.2
Kernel version: 2.6.32.9 MID Serials #1518 Wed Apr 6 16:09:52 CST 2011
Build Number: MID Serilas 2.2 FRF91 20110402.171535


On Wed, Jun 8, 2011 at 5:10 AM, Dianne Hackborn hack...@android.com wrote:

 Which device is this?

 On Tue, Jun 7, 2011 at 1:32 AM, Marcin Mikosik 
 marcin.miko...@gmail.comwrote:

 Hi,

 I'm experimenting with newly bought android tablet and found out that
 android API it provides does not comply with android API
 documentation/specification.
 Specifically Display.getRotation() and Accelerometer readings returns
 values that contradicts each other.

 For example:
 running application that has android:screenOrientation=landscape and
 quering Display.getRotation() returns Surface.ROTATION_0 which means this
 tablet is landscape-default device as described in
 http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

 Still, when running the same application and holding device in landscape
 orientation in front of me, I get accelerometer reading that says something
 around: X=10, Y=0 which is clearly wrong because accelerometer coordinate
 system should be aligned with device default orientation (landscape in this
 case). According to blogpost mentioned above - when I keep device in its
 default-orientation (which is landscape in this case) I should get
 accelerometer reading X=0, Y=10.

 Can anybody suggest what's wrong here?
 Either my device is broken or its software has a bug or I misunderstood
 the API semantics (?)

 thanks
 Marcin

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en