I'm trying to make do water simulation. But I'm restricted to use 2D, So i started with just making the boundary of the sea by using sine wave, through Gl_Line_loop. but I'm just unable to fill it. I have tried changing it to the Gl_polygon mode but then i don't get the proper shape. here is the code:
To tessellate the above, specify a top then a bottom vertex right along the line, then draw a triangle strip. i.e. for each (x, y) position along the sin wave, emit two vertices, the same x but y = 0 (the bottom). Then render a triangle strip.
Something like this:
glBegin(GL_TRIANGLE_STRIP);
for(x=-50;x<=50;x+=inc){
k = 2 * 3.14 / wavelength;
y = amplitude * sin(k * x);
glVertex3f(x, y-35, 0);
glVertex3f(x, y, 0);
}
glEnd();