Hi at all, I have a terrible issues with texure sphere mapping.

This is my code:

public void onSurfaceCreated(GL10 gl10, EGLConfig config) {

                GL11 gl = (GL11) gl10;
                gl.glDisable(GL10.GL_DEPTH_TEST);                       
//Disable Depth Testing
                gl.glEnable(GL11.GL_TEXTURE_2D);
                gl.glEnable(GL11.GL_CULL_FACE);
                gl.glCullFace(GL11.GL_FRONT);
                gl.glFrontFace(GL11.GL_CCW);
                sphere.loadGLTexture(gl10, context);
}

public void onDrawFrame(GL10 gl10) {

                GL11ExtensionPack gl= (GL11ExtensionPack) gl10;

                gl10.glMatrixMode(GL10.GL_PROJECTION);
                gl10.glLoadIdentity();
                gl10.glFrustumf(-5.0f, 5.0f, -5.0f, 5.0f, 1.0f, 100.0f); //Mio
                gl10.glMatrixMode(GL10.GL_MODELVIEW);
                gl10.glLoadIdentity();
                GLU.gluLookAt(gl10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -10.0f, 0.0f, 
1.0f,
0.0f);
                sphere.draw(gl10);
}

public void onSurfaceChanged(GL10 gl, int width_, int height_) {
                gl.glViewport(0, 0, width, height);


        }

public void draw(GL10 gl10) {

                GL11ExtensionPack gl = (GL11ExtensionPack) gl10;
                GL11 gl11 = (GL11) gl10;
                gl.glBindTexture(GL10.GL_TEXTURE_2D, textures_ids.get(0));
                gl10.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, totalVertexCount);
}

public void loadGLTexture(GL10 gl10, Context context) {

                GL11 gl = (GL11) gl10;
                gl.glGenTextures(2, textures_ids);
                gl.glBindTexture(GL10.GL_TEXTURE_2D, textures_ids.get(0));
                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.glEnableClientState(GL10.GL_VERTEX_ARRAY);
                gl.glVertexPointer(3, GL11.GL_FLOAT, 0, vertexBuffer);
                gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
                gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0,textureBuffer);

        }

The vertexbuffer contains a points for a sphere and the texturebuffer
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.

pedr0

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to