Before posting here, I googled this issue, and did find one other
unsolved thread about this same issue.
If anyone else comes here after googling, here's information about
what happened between it not working and working:
(I'm not sure which of these steps is what fixed it, and I don't
intend to find out :))

I got rid of everything GL11 (everything is GL10 now).

I changed my LoadTexture function from:

int LoadTexture(int resID,GL10 gl){
        Resources res = gp.getContext().getResources();
        Bitmap bmp = BitmapFactory.decodeResource(res,resID);
        int[] tmp_tex = new int[1];
        gl.glGenTextures(1, tmp_tex, 0);
        int tex = tmp_tex[0];
        gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_ALPHA,
GL10.GL_ALPHA_BITS);
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
        bmp.recycle();
      return tmp_tex[0];
   }




to



int LoadTexture(int resID,GL10 gl)
        {
                 int[] textures = new int[1];
                gl.glGenTextures(1, textures, 0);
                int mTextureID = textures[0];
                gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST);
        
gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
                gl.glTexEnvf(GL10.GL_TEXTURE_ENV,
GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
                InputStream is =
gp.getContext().getResources().openRawResource(resID);
                Bitmap bitmap;
                try {
                    bitmap = BitmapFactory.decodeStream(is);
                } finally {
                    try {
                        is.close();
                    } catch(IOException e) {
                        // Ignore.
                    }
                }
                GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
                bitmap.recycle();
                return mTextureID;
        }
}


(I found the body of this in the ApiDemo with the 3 letters on a
textured triangle spinning).
Only a few differences, but they are there.

Again, I'm not sure which of those two things is what fixed it (and
it's even possible that it was something else that I don't remember
doing).

Hopefully this helps someone else.

(and thanks to R. Green for testing it on his Droid).


On Feb 26, 2:05 pm, Barrett_A <lbarrettander...@gmail.com> wrote:
> I'm using GLSurfaceView to render OpengGL 3D.  It works great on my
> nexus one, the emulators, and at least the G1.  However, on the droid,
> the textures are white.  I've seen this problem before when textures
> aren't loaded, and also when they aren't powers of two dimensions (not
> the case here).  What's weird is that this started when I converted my
> program to use GLSurfaceView (it used to be based on some older
> example where I was doing the EGL stuff myself).
>
> Textures displayed on the screen are white, but shapes that are just
> colors are displayed just fine.
>
> The person testing this for me on their droid does not have the sdk,
> so if anyone would like to run this with the debugger, let me know and
> I can get you the apk.
>
> Thanks for any help!

-- 
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