Spherical harmonics

Hi,
I’m trying to render spherical harmonics,I’m using the sample code from Paul Bourke site, but I get a GL_INVALID_VALUE error while evaluating the last point of the quad.
Here is the url : http://astronomy.swin.edu.au/pbourke/geometry/sphericalh/

The sample uses quads to render the surface, is it possible that the four points of the quad doesn’t lie on EXACTLY the same plane ?
Is there a sort of tolerance in wich OGL accepts vertex like they are on the same plane ?

Do someone knows some other samples on line on rendering spherical harmonics with OGL ?

Thanks.

rIO.sK http://www.spinningkids.org/umine

P.S: I don’t wanna in any way say that P.Bourke code is wrong,it’s surely my fault, his site is really gr8 a must visit for every math programmer.

Beautiful images!

glColor, glNormal, and glVertex do not issue any OpenGL error.
You can issue quads in any form as long as they are convex. Planarity is not checked and the algorithm from Paul Bourke does not care for planar faces.

How did you come to the conclusion that it’s the fourth vertex? It’s not allowed to call glGetError between glBegin-glEnd.

[This message has been edited by Relic (edited 02-27-2001).]

Because if I leave away the call to the last vertex and change the mode to GL_TRIANGLES everything seems working.

Right now, I’m trying the same code on a G400, the glGetError gives me no error, but if I draw triangles I have the spherical harmonic, if I draw quads I get some strange shaped things that doesn’t look really like a S.H.

Humm…

rIO.sK http://www.spinningkids.org

Check if it works with a Microsoft GDI generic pixelformat (PFD_GENERIC_FORMAT).
If yes, the Matrox driver is at fault.
If not, isolate one faulty quad and
check if the order of the four vertices is correct (counter clockwise) otherwise you get concave quads which could lead to all sorts of wrong displays.

My GOD !
Gotta use one hammer on my jewels !

Of course that’s all was mine fault, going reading memory where no man has gone before. Maybe yesterday night it was a bit late to se it.

Forget this thread ASAP…

rIO.sK http://www.spinningkids.org

You could also use a triangle strip of 2 triangles in place of the quad. Then non-planarity would never be an issue either.