Yes, that's what I'm saying is your issue.  From your code sample I
see that you never held on to the actual texture ID from tmp_tex[] or
textures[], so you could have never recalled it correctly to bind to
it later for drawing.

On Aug 10, 1:52 am, Mike <mcmulle...@gmail.com> wrote:
> Well that wasn't it but you were on the right path. It is something to
> do with my texture selection. I took a break down at the local pub and
> after a few beers I saw much clearer. :)
>
> I'll post an update sometime tomorrow after I get everything nailed
> down completely. Thanks everyone for the help.
>
> On Aug 9, 11:47 pm, Robert Green <rbgrn....@gmail.com> wrote:
>
>
>
> > Heh, I think I see your problem.
>
> > Replace  this.textureMap.put(new Integer(textureFiles[i]), new
> > Integer(i));
> > With  this.textureMap.put(new Integer(textureFiles[i]), new
> > Integer(tmp_tex[i]));
>
> > Droids don't number textures incrementally like qualcomms do.  It was
> > working because your texture ids happened to align with i.
>
> > On Aug 9, 11:35 pm, Nightwolf <mikh...@gmail.com> wrote:
>
> > > Why do you set GL_TEXTURE_MIN_FILTER twice? Replace one of the calls
> > > with GL_TEXTURE_MAG_FILTER.
>
> > > On Aug 10, 5:22 am, Mike <mcmulle...@gmail.com> wrote:
>
> > > > Welp, I did even better. I went out and bought a Droid from
> > > > Craigslist.
>
> > > > I logged the height and width of the bitmaps at each of the mipmap
> > > > levels and here's the output:
>
> > > > DEBUG/Texture(1558): Texture image loaded at 256 x 256
> > > > DEBUG/MMTexture(1558): Texture image loaded at 128 x 128
> > > > DEBUG/MMTexture(1558): Texture image loaded at 64 x 64
> > > > DEBUG/MMTexture(1558): Texture image loaded at 32 x 32
> > > > DEBUG/MMTexture(1558): Texture image loaded at 16 x 16
> > > > DEBUG/MMTexture(1558): Texture image loaded at 8 x 8
> > > > DEBUG/MMTexture(1558): Texture image loaded at 4 x 4
> > > > DEBUG/MMTexture(1558): Texture image loaded at 2 x 2
> > > > DEBUG/MMTexture(1558): Texture image loaded at 1 x 1
>
> > > > So, if it's not the size that's the problem, something with the format
> > > > of the bitmaps themselves? Well at least now I have a phone to test
> > > > on.
>
> > > > On Aug 9, 7:35 pm, String <sterling.ud...@googlemail.com> wrote:
>
> > > > > Can I suggest you stick a Log call in with your actual loaded texture
> > > > > sizes? Something like the following:
>
> > > > >     Log.i(TAG, "Texture image loaded at " + mapImage.getWidth() + " x
> > > > > " + mapImage.getHeight());
>
> > > > > Then get one of the Droid/Milestone users to shoot you a logcat
> > > > > output... xda-devs folks ought to be able to handle that. That'll at
> > > > > least tell you if the images are loading at the size you expect, or if
> > > > > it's a different problem.
>
> > > > > String
>
> > > > > On Aug 9, 10:11 pm, Mike <mcmulle...@gmail.com> wrote:
>
> > > > > > I am. That's what's so perplexing.
>
> > > > > > On Aug 9, 3:56 pm, Tom <orei...@mbari.org> wrote:
>
> > > > > > > Make sure that you are loading your textures from the 
> > > > > > > drawable-nodpi
> > > > > > > resource 
> > > > > > > directory:http://www.anddev.org/opengl_textures_-_motorola_droid-t10930.html
>
> > > > > > > On Aug 9, 1:07 pm, Mike <mcmulle...@gmail.com> wrote:
>
> > > > > > > > I'm getting white (blank) textures on everything when running 
> > > > > > > > on the
> > > > > > > > Droid and Galaxy S devices.
> > > > > > > > My textures are all power-of-two PNGs and they're in the 
> > > > > > > > /res/drawable-
> > > > > > > > nodpi folder.
>
> > > > > > > > Here's my code:
>
> > > > > > > > public GLTextures(GL10 gl, Context context) {
> > > > > > > >                 if(gl==null)return;
> > > > > > > >                 this.gl = gl;
> > > > > > > >                 this.context = context;
> > > > > > > >                 this.textureMap = new 
> > > > > > > > java.util.HashMap<Integer, Integer>();
> > > > > > > >                 sBitmapOptions.inPreferredConfig = 
> > > > > > > > Bitmap.Config.RGB_565;
>
> > > > > > > >         }
>
> > > > > > > >         public void freeTexs(){
> > > > > > > >                 gl.glDeleteTextures(textures.length, 
> > > > > > > > textures,0);
> > > > > > > >                 textureFiles = null;
> > > > > > > >         }
>
> > > > > > > >         public void loadTextures() {
> > > > > > > >                 if(gl==null)return;
> > > > > > > >                 int[] tmp_tex = new int[textureFiles.length];
> > > > > > > >                 gl.glGenTextures(textureFiles.length, tmp_tex, 
> > > > > > > > 0);
> > > > > > > >                 textures = tmp_tex;
> > > > > > > >                 for (int i = 0; i < textureFiles.length; i++) {
>
> > > > > > > >                         this.textureMap.put(new 
> > > > > > > > Integer(textureFiles[i]), new Integer(i));
> > > > > > > >                         int tex = tmp_tex[i];
>
> > > > > > > >             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_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_NEAREST);
>
> > > > > > > >             gl.glTexParameterf(GL10.GL_TEXTURE_2D,
> > > > > > > > GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
> > > > > > > >             gl.glTexParameterf(GL10.GL_TEXTURE_2D,
> > > > > > > > GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
> > > > > > > >             gl.glTexEnvf(GL10.GL_TEXTURE_ENV,
> > > > > > > > GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE);
>
> > > > > > > >             InputStream is =
> > > > > > > > context.getResources().openRawResource(textureFiles[i]);
> > > > > > > >             Bitmap bitmap;
> > > > > > > >             try {
> > > > > > > >                 bitmap = BitmapFactory.decodeStream(is, null,
> > > > > > > > sBitmapOptions);
> > > > > > > >             } finally {
> > > > > > > >                 try {
> > > > > > > >                     is.close();
> > > > > > > >                 } catch (IOException e) {
> > > > > > > >                     // Ignore.
> > > > > > > >                 }
> > > > > > > >             }
>
> > > > > > > >             buildMipmap(gl, bitmap, tex);
> > > > > > > >             bitmap.recycle();
>
> > > > > > > >                 }
> > > > > > > >         }
>
> > > > > > > > private void buildMipmap(GL10 gl, Bitmap bmp, int tex) {
> > > > > > > >                 //
> > > > > > > >                 int level = 0;
> > > > > > > >                 //
> > > > > > > >                 int height = bmp.getHeight();
> > > > > > > >                 int width = bmp.getWidth();
>
> > > > > > > >                 while (height >= 1 || width >= 1) {
> > > > > > > >                         GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 
> > > > > > > > level, bmp, 0);
>
> > > > > > > >                         if (height == 1 || width == 1) {
> > > > > > > >                                 break;
> > > > > > > >                         }
> > > > > > > >                         // Increase the mipmap level
> > > > > > > >                         level++;
> > > > > > > >                         //
> > > > > > > >                         height /= 2;
> > > > > > > >                         width /= 2;
> > > > > > > >                         Bitmap bitmap2 = 
> > > > > > > > Bitmap.createScaledBitmap(bmp, width, height,
> > > > > > > > true);
> > > > > > > >                         // Clean up
> > > > > > > >                         bmp.recycle();
> > > > > > > >                         bmp = bitmap2;
> > > > > > > >                 }
> > > > > > > >         }
>
> > > > > > > > Here's my setup code in my renderer's onSurfaceCreated method:
>
> > > > > > > >                                 // Define the lighting
> > > > > > > >                 float lightAmbient[] = new float[] { 1f, 1f, 
> > > > > > > > 1f, 1 };
> > > > > > > >                 float lightDiffuse[] = new float[] { 1, 1, 1, 1 
> > > > > > > > };
> > > > > > > >                 float[] lightPos = new float[] { 0, 0, 0, 1};
> > > > > > > >                 gl.glEnable(GL10.GL_LIGHTING);
> > > > > > > >                 gl.glEnable(GL10.GL_LIGHT0);
> > > > > > > >                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, 
> > > > > > > > lightAmbient, 0);
> > > > > > > >                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, 
> > > > > > > > lightDiffuse, 0);
> > > > > > > >                 gl.glLightf(GL10.GL_LIGHT0, 
> > > > > > > > GL10.GL_CONSTANT_ATTENUATION, 1.0f);
> > > > > > > >                 gl.glLightf(GL10.GL_LIGHT0, 
> > > > > > > > GL10.GL_LINEAR_ATTENUATION, 0.01f);
> > > > > > > >                 gl.glLightf(GL10.GL_LIGHT0, 
> > > > > > > > GL10.GL_QUADRATIC_ATTENUATION, .1f);
> > > > > > > >                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, 
> > > > > > > > lightPos, 0);
>
> > > > > > > >                 // Define the materials
> > > > > > > >                 float matAmbient[] = new float[] {1, 1, 1, 1 };
> > > > > > > >                 float matDiffuse[] = new float[] {1, 1, 1, 1 };
> > > > > > > >                 gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, 
> > > > > > > > GL10.GL_AMBIENT, matAmbient,
> > > > > > > > 0);
> > > > > > > >                 gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, 
> > > > > > > > GL10.GL_DIFFUSE, matDiffuse,
> > > > > > > > 0);
>
> > > > > > > >                                 
> > > > > > > > gl.glDisable(GL10.GL_DEPTH_TEST);
> > > > > > > >                 gl.glEnable(GL10.GL_BLEND);
> > > > > > > >                 gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
> > > > > > > >                 gl.glDepthFunc(GL10.GL_LEQUAL);
> > > > > > > >                 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
> > > > > > > >                 gl.glDisable(GL10.GL_DITHER);
>
> > > > > > > >                 //Enable textures
> > > > > > > >                 
> > > > > > > > gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,GL10.GL_NICEST);
> > > > > > > >                
>
> ...
>
> read more »

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