Generating a surface from a grid


I’m working on application that draws lenses on the screen. I have sample points from each lens, which are ordered on X-Y grid, and each sample has a Z value that describes the height of the lens at that X-Y point on the grid.

Now, I want to plot the surface of the lens on the screen, using OpenGL.
Since I’m new in the OpenGL world, I have two questions:

  1. Does OpenGL has tools to triangulate my sample points to a nice polygoned-mesh? If it doesn’t, do you know some references to perform this task?

  2. Is it possible to plot the surface in OpenGL, directly using the sample points, without triangulating them to polygons (please note that they are ordered on X-Y grid)?

Thanks in advance

has a paper (actually thesis) on surface reconstruction from points. This is actually a link suggested in a previous post in this forum, not so long ago with the - not-so-revealing title Algorithm. I haven’t gone thru the paper in detail myself, but it might be a good start.

From an OpenGL point of view, I see 3 options for you.

  1. Create triangles yourself using your points, and render these triangles. You will need code to do the triangulation, and possibly, lots of stuff from this guy’s paper and further reading.

  2. Approximate your lens using quadrics (via glu quadrics). This could work for quite a few simple lens. You have to write code to find out the type of quadrics and their position/orientation.

  3. Approximate the lens using OpenGL nurbs. You have to write code to create the nurbs surface that goes through your points.