I am new to OpenGL and mobile programming in general.
I am trying to load 2 textures and show them on the same object (I mean one set of faith) with different coordinates.
My approach:
glGenTextures(2, &textures[0]);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture( GL_TEXTURE0 );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textures[0]);
glTexCoordPointer(2, GL_SHORT, 0, mapTextCoords);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, map.width, map.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, [map getByteData]);
glActiveTexture(GL_TEXTURE1);
glClientActiveTexture( GL_TEXTURE1 );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexCoordPointer(2, GL_SHORT, 0, backgroundTextCoords);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, background.width, background.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, [background getByteData]);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, mapVertices);
What am I doing wrong? And what should I do next?
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glDrawArrays(GL_TRIANGLE_STRIP, 0, BYTES_PER_PIXEL);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
As a result, I got a white object (no textures at all).