[android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation
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
Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation
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 wrote: > 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 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 >> >>> 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.a
Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation
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
Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation
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 > 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
Re: [android-developers] OpenGL Samsung Galaxy S2 S II Problem With Rotation
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 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 > >> 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] OpenGL Samsung Galaxy S2 S II Problem With Rotation
The problem is that i'm in your same situation but i even use the mipmapping. Maybe only few changes during initialization can fix it, but without an sg2 to test is too hard. Anyone has ideas or fixed something similar on sg2?? Thank you in advance Il giorno 09/set/2011 16.31, "Marcin Mikosik" ha scritto: > 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 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 >> >>> 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