Monday, January 14, 2013

Re: [android-developers] GLUtils.texImage2D

Don't flip the bitmap, flip your texture coordinates. It's easier and less work for the device.

On Jan 14, 2013 7:03 AM, "bob" <bob@coolfone.comze.com> wrote:
Has anyone else noticed that GLUtils.texImage2D seems to want the image to be upside down?

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

One way to see this is to look at Cosmin Banu's NeHe code here:



He has this in there:

      private static Matrix yFlipMatrix;
        
        static
        {
                yFlipMatrix = new Matrix();
                yFlipMatrix.postScale(1, -1); // flip Y axis
        }

And this:

return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), yFlipMatrix, false);


I have independently noticed this, and it caused a lot of frustration.

Any ideas how to best solve this?  Obviously, if we "just fix it", it will break a lot of old code that relies on its currently incorrect behavior.

--
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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment