Well I've come up with a solution, but I'd still like to hear from
others if you have a better way of doing it.

private int loadTexture(GL10 gl, Bitmap bmp)
{
        int level = 0;
        int size = bmp.getHeight();

        int[] textures = new int[1];
        gl.glGenTextures(1, textures, 0);
        int textureId = textures[0];

        gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);

        while(size >= 1)
        {
                GLUtils.texImage2D(GL10.GL_TEXTURE_2D, level, bmp, 0);

                if(size == 1)
                        break;

                level++;
                size /= 2;
                Bitmap bmp2 = Bitmap.createScaledBitmap(bmp, size, size, true);
                bmp.recycle();
                bmp = bmp2;
        }

        return textureId;
}

On Jul 14, 9:20 am, Mike <mmille...@gmail.com> wrote:
> I've created a simple heightmap renderer for Android, and am at the
> point where I'd like to apply textures to the terrain. I've had
> success with applying a simple texture but there is an unbearable
> amount of texture aliasing visible, I guess because there are no
> mipmaps for the texture. I could not find any way of automatically
> generating mipmaps as all the usual OpenGL methods seem to be
> unsupported.
>
> Have any of you figured out how to generate mipmaps on Android? Do we
> need to write our own implementation to to it?
>
> Thanks,
> Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to