Hi,
I am working on water surface simulation, as a newbie in openGL, with lots of help from this forum I have completed the dynamics and the refraction maps.
Now, next step is reflection of sky in to my water surface. I have read tutorials and topics related to blending. I understand that blending is done when two textured(or colored) primitives overlap and then we can make them translucent so that we can see through them.
My problem is I have only one primitive i.e my triangular mesh. I have created the mesh using glDrawElements(),
and then Textured with the image of floor (pond). I have used the following code to blend the sky image with this image so as to give the effect of reflection, but there is some thing wrong with either my logic or code.
glBlendFunc(GL_ONE, GL_ONE);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, textureArray[0]); // first image
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, textureArray[1]); // second image
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE);
glPushMatrix();
glTranslatef(-(n/2),-(n/2),0);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, normals);
glTexCoordPointer(2,GL_FLOAT,0,tex);
glVertexPointer(3,GL_FLOAT,0,vertices);
glDrawElements(GL_TRIANGLES,6*(n-1)*(n-1),GL_UNSIGNED_INT,indices);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
Also I am confused, in my case do I have to do Multitexturing or Blending?