Mapping a sphere
Hi at all, I have a terrible issues with texure sphere mapping.
This is my code:
gl.glDisable(GL10.GL_DEPTH_TEST); //Disable Depth Testing
gl.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
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 );
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, this.image, 0);
gl.glVertexPointer(3, GL11.GL_FLOAT, 0, vertexBuffer);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0,textureBuffer);
gl10.glFrustumf(-15.0f, 15.0f, -15.0f, 15.0f, 1.0f, 100.0f); //Mio
GLU.gluLookAt(gl10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -10.0f, 0.0f, 1.0f,0.0f);
gl10.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, totalVertexCount);
The vertex buffer contains a points for a sphere and the texture contains the normals for that, I meet an horrible result and I don't understand what's wrong...
This is the result img:
I am working with android OpenGL ES but I think error isn't correlated with my platform but is correlated with my use of OpenGL API, I am a newbye with this library.
Thanks so much in advance.
Re: Mapping a sphere
Please enclose code snippets with for better readability.
Why do you cull front faces and disable depth testing? Anyway, it seems your texture is being used (at least it looks that way in the picture you uploaded), so my guess would be that there is something wrong with the texture coordinates.
You might want to use a checker board texture for debugging this as it may make it a bit easier to see if it gets mapped correctly.