I have 30X30 matrix data to plot. If I use polygons to draw the 3D surface, it is not smooth. Is there any inbuilt mechanism in opengl to smoothen the surface?

I’m assuming your data is regularly spaced, i.e. defined on a grid?

I don’t think ogl can help you necessarily, but you can use your data points as control points and define interpolated polygons using a smoother interpolant such as bicubic, or even quadratic langrange (use 9 points for each cell)…

Opengl splines might help, but they don’t interpolate all of the control points…

I’ve done something similiar to what you want using patch based interpolation (least squares fit to a poly around each node and average)–bit of overkill for a regular grid, though…

Do you have a wireframe or solid surface? Either could be made up of ‘polygons’? If it’s a solid surface: are you using simple coloring, or lighting? To use lighting you must compute normals for each polygon (easy to do). If you specify one normal per polygon you’ll get a faceted surface. To get smooth shading, you have to specify a normal for each vertex of every poly. You can compute vertex normals by averaging the polygon normals that share that vertex. It would help if you showed us a picture of what you have now.

I think you can use a geometry shader to interpolate, but otherwise you need to interpolate at design time.

Otherwise, you can smooth out the edges a bit by averaging normals of neighboring faces. You can also add some fake surface detail with bump mapping to make your surface look more detailed.

Yes it is regularly spaced.

i want all the points to be exactly mapped on the surface.

Thanks.

What about http://en.wikipedia.org/wiki/Bicubic_interpolation ?

Do this for the geometry, with smooth normal interpolation between faces as said ugluk.

Thank you MaxH. I specified a normal for each vertex, surface became very smooth.

Congrats. Thanks for the visual feedback.

Thank you @MaxH. I had a similar question and your solution also worked for me (defining each vertex’s normal as the average of normals of triangles containing it). +1