[solved]Blend two textures for one vbo

Hi! This is my first post so I’m not sure if I’m posting this in the right place :confused:

So I’m trying two blend two textures(earth surface, clouds) onto a simple sphere created using an obj file that I exported from blender. I’m using 4 buffer objects for the vertices, textureCoords, normals and faces. Before adding the second material(clouds) my result looked fine:

Then I added the second material to the rendering code which now looks like this:


public void render()
{
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);

    glBindBuffer(GL_ARRAY_BUFFER, handles.get(VERTEX));
    glVertexPointer(3, GL_FLOAT, 0, 0);

    material.bind(); // the earth's surface texture
    glBindBuffer(GL_ARRAY_BUFFER, handles.get(TEXTURE));
    glTexCoordPointer(2, GL_FLOAT, 0, 0);

    material2.bind(); // the semi transparent cloud texture
    glBindBuffer(GL_ARRAY_BUFFER, handles.get(TEXTURE));
    glTexCoordPointer(2, GL_FLOAT, 0, 0);

    glBindBuffer(GL_ARRAY_BUFFER, handles.get(NORMAL));
    glNormalPointer(GL_FLOAT, 0, 0);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handles.get(FACE));
    glDrawElements(GL_TRIANGLES, modelScheme.getIndices().size(),    GL_UNSIGNED_INT, 0);

    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
}

And enabled blending in the opengl initializing code:


glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);

And the result I’m getting now is this:

Does anyone know why this effect happens instead of the two materials blend together nicely? If anyone is interested the two textures I use for the materials are these:

(In the cloud texture for some reason the transparent parts are not showing here)

I Apologise for the big post and I wish you all the best

Cheers,

Alex