I am having issues doing a simple water quad over a terrain square.
Once I place the Quad into the scene with the height-mapped terrain. I get a jagged coast-line. I am not sure what I am doing wrong here. I think I have correctly enabled blending, because the water is transparent.
here is a screenshot
What am i missing here?
I’ve placed this code before the water:
glEnable( GL_BLEND );
glDepthMask( GL_FALSE );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
glPushMatrix();
glBegin( GL_QUADS );
//water
glColor4f( 0.0f, 0.2f, 0.7f, 0.7f );
glVertex3f( 0.0f, 20.0f, 0.0f );
glVertex3f( 0.0f, 20.0f, (float)[terrain iSize] );
glVertex3f( (float)[terrain iSize], 20.0f, (float)[terrain iSize] );
glVertex3f( (float)[terrain iSize], 20.0f, 0.0f );
glEnd();
glPopMatrix();
glDepthMask( GL_TRUE );
glDisable( GL_BLEND );
I also enable it with glDepthTest, and glDepthFunc
I am not sure what else to do here to remove the jagged coastline. The resolution shouldn’t be too much of an issue, because its 128 x 128.