Did you use directly-allocated buffers?
Did you set the buffer positions to 0 if added to them after
constructing?
I didn't see a projection in your list.  What are you doing to set it
up?

When texturing use GL_NICEST as the perspective correction hint or
it'll distort when not at 90 degrees to view
Your UVs don't appear to be correct, as they start in upper left and
your quad starts in lower left.  That will produce a rotated image -
shouldn't be what you describe.

Could you show us the texture and then a screenshot of the bad
rendering?

On Jun 29, 1:19 pm, iconnary <iconn...@gmail.com> wrote:
> I'm having great difficulty getting basic textures to work in an
> OpenGL ES app on my Droid (2.1-update1). I trying to render a simple
> textured quad - four vertices, two faces, with normals and texture
> coords. When rendered, the texture is garbled and full of static,
> similar to TV noise.   The basic colors from the texture map are
> there, but obviously the texture isn't being read or applied
> correctly.
>
> My texture load sequence is simple :
> int[] textures = new int[1];
> gl.glGenTextures(1, textures, 0);
> Bitmap bmp = BitmapFactory.decodeResource(cx.getResources(),
> R.drawable.img);
> gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
> GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
>
> I've tried setting various parameters for glTexParameterf at texture
> load time, but to no avail :
>
> 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_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_REPLACE);
>
> My render sequence is also very simple :
>
> (setup)
> gl.glEnable(GL10.GL_DEPTH_TEST);
> gl.glDepthFunc(GL10.GL_LEQUAL);
> gl.glDisable(GL10.GL_DITHER);
> gl.glDisable(GL10.GL_FOG);
> gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
> gl.glDisable(GL10.GL_COLOR_MATERIAL);
> gl.glShadeModel(GL10.GL_SMOOTH);
>
> (render)
> gl.glEnable(GL10.GL_TEXTURE_2D);
> gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
> gl.glVertexPointer(3, GL10.GL_FIXED, 0, vertices);
> gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
> gl.glTexCoordPointer(2, GL10.GL_SHORT, 0, textureCoords);
> gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);
> gl.glDrawElements(GL10.GL_TRIANGLES, numIndices,
> GL10.GL_UNSIGNED_SHORT, indices);
> ...
>
> I've tried various texture image file formats, all sized ^2, placed
> under the drawable-nodpi folder. PNG, BMP, GIF, JPEG all give me the
> same result. I've also tried 8 and 16 bit color depths. I'm running
> this on top of GLSurfaceView with the default EGL config.
>
> Can anyone shed some light on why my texture is coming through
> garbled?
>
> Below is my index/vertex/normal/texcoord data. I've been over it a
> dozen times but perhaps I missed something.
>
> Adding vertex (vIndex 0) Vector3F(77.0492, 0.0, 121.5453)
> Adding vertex (vIndex 1) Vector3F(478.1715, 0.0, 121.5453)
> Adding vertex (vIndex 2) Vector3F(478.1715, 227.0969, 121.5453)
> Adding vertex (vIndex 3) Vector3F(77.0492, 227.0969, 121.5453)
> Adding normal Vector3F(0.0, 0.0, 1.0)
> Adding normal Vector3F(0.0, 0.0, 1.0)
> Adding normal Vector3F(0.0, 0.0, 1.0)
> Adding normal Vector3F(0.0, 0.0, 1.0)
> Adding textureCoords Vector3F(0.0, 0.0)
> Adding textureCoords Vector3F(1.0, 0.0)
> Adding textureCoords Vector3F(1.0, 1.0)
> Adding textureCoords Vector3F(0.0, 1.0)
> Adding face indexes 1,2,3
> Adding face indexes 3,4,1

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