rendering an ellipsoid

Started by
6 comments, last by glSmurf 18 years, 9 months ago
just wondering if someone could pass me the code to render an ellipsoid with opengl... I just need it for debugging and I realy don't want to put more time into it then necessary. tnx
Advertisement
GLUquadricObj* obj = gluNewQuadric();glScale3f(radiusX, radiusY, radiusZ);gluSphere(obj, 1.0, 10, 10);gluDeleteQuadric(obj);

Untested, but it's really simple so it should work.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
Doesn't OpenGL have some built-in support for rendering spheres? Perhaps you could render a unit sphere, but call glScale() first with the ellipse extents as arguments.

You could also tessellate your own, but that can be a little involved.
I'm close to implement ellipsoid rendering for collision detection debugging. I use DirectX so I don't know with OpenGl. Personally I would scale a unit sphere by the ellipsoid radius
I've already tried scaling a unit sphere... works fine untill the ellipsoid is rotated.

tnx anyways =/
For one thing, you should be able to rotate the unit sphere after you scale it, giving you the ellipsoid you need in any orientation.

Also, I wrote some code a while ago that projects a 3D ellipsoid into a major and minor axis that lie on the projection plane. Then I render a rectangular billboard using the two axes with a spherical glow map texture stretched onto it. Aside from being flat and unshaded, it looks exactly like the ellipsoid it's supposed to represent from any angle. It might be of some use to you. If you're interested, send me a PM or an email.
Quote:I've already tried scaling a unit sphere... works fine untill the ellipsoid is rotated.
As s_p_ said, just rotate the sphere after scaling it:

glTranslate(position.x, position.y, position.z);
glRotate(angle, axis.x, axis.y, axis.z);
glScale3f(radius.x, radius.y, radius.z);
DrawUnitSphere();

With this you should be able to position and orient the ellipsoid in whatever way you want.
doh ...for some reason I must have scaled it before rotating it. thanks alot =)

This topic is closed to new replies.

Advertisement