I'm making a program to plot functions using surfaces: i've got an array with points and have to create a surface using them. I've heard about an algorithm called "painter algorithm" or similar.

Anybody knows how to implement this "painter algorithm"?
Is there any OpenGL function or code to create a surface from a given set of points?

Thanks in advance