There should be a way to make spheres with two radii so that one could be larger than the other. This could make “squashed” spheres, to give the look of pente stones.


Ah, you are right. That would be the way to do it. I still think there should be two arguments for the radii in gluSphere() just to make it easier… I didn’t even know that function existed!

glScale is probably in chapter 1 of any book on OpenGL. Why do you think you can suggest changes to an API you don’t have any knowledge of whatsoever?
You have some reading to do.

Yep, you can use glScale to do that but adding a second parameter to the gluSphere won’t hurt.

I think GLU and GLUT are going to be deprecated in Longs Peaks in favor of a D3DX-style auxiliar library layer and I bet we will get some geometry primitive creation functions… and on the contrary case you can always build your own ellipsoid creation routine :stuck_out_tongue:

knackered, I don’t happen to have an OpenGL book. santyhamer, I was just getting used to GLU and GLUT!

oh right, that’s a good enough reason for your post. In fact, you should be given a place on the ARB so we can all benefit from more of your genius suggestions about an API you know nothing about.

While I find knackered a bit harsh on this one, I agree that you should have done better research before posting this suggestion. Moreover - GLU doesn’t really belong to OpenGL, it is just an utility library on it’s top.

Sheesh, I didn’t come here for help. I came for a suggestion. I was certain that there was indeed a way to do such a thing, but I had no need to. By my first post, I should have made it clear by saying “gluSphere() should have 2 radii” instead of “sphere”. It seemed and still seems weird that the way to make a squashed sphere requires an extra function, and, though I don’t know, a third to reset it. The type of sphere should be in the sphere function, not a separate call, it would make more sense, anyway, as a sphere is a type of ellipsoid where the two radii are the same.

Originally posted by Zengar:
Moreover - GLU doesn’t really belong to OpenGL, it is just an utility library on it’s top.
Yes, but I’d rather not learn the functions of a new library.

If a sphere is an ellipsoid with all radii the same, then it makes perfect sense to call it gluSphere and only give it one radius parameter. If you specify all radii explcitely, it would be gluEllipsoid, but it isn’t.

And also, you would specify three radii, not two; one along each axis. That would make it more general and what you’re suggesting.

But it still isn’t as general as it can be, becuase you can still specify the axes along which the radii are specified. And who said the axes have to be object space axis aligned? Since those axes doesn’t have to form an orthonormal basis, you would basically have to add 9 more parameters to specify the axes. And add a center point to that aswell, because you may not want to draw it at the origin, making it 3 more parameters.

So in the end, it’s either a sphere and do the radii (glScale), axes (glRotate for orthonormal bases, custom matrix and glMultMatrix otherwise) and centerpoint (glTranslate) with separate functions, or specify them all in a function taking at elast 15 parameters (3 radii, 3 axes of 3 coordinates each and 3 for the centerpoint). Honestly, I think the sphere is good as it is if you know how to work with it.

Except in certain cases, a three radius object would not be an ellipsoid, though you could make some cool objects. So sure, you could add a third radius to be complete. Perhaps the radii argument could be specified as a tuple with 1, 2, or 3 arguments.

If I understand what you’re saying, glTranslate() and glRotate() work fine for orienting and placing the object.

The axes at not right angles pose an interesting problem, but assuming they’re right angles and having three radii is still more flexible than one radius.

So, in the end, you would have a function with the same number of arguments as the normal function looking like:
“gluSphere(Sphere, (1.0 ), 800, 800)” or
“gluSphere(Sphere, (1.0,0.5 ), 800, 800)” or
“gluSphere(Sphere, (0.5,0.5,0.3), 800, 800)”
for a sphere, ellipsoid, and 3D object, respectively.

You would probably change the name of the function to something more intuitive, too.

This way, you’d eliminate calls to glScale(), and/or gl[Push/Pop]Matrix()

In which cases would three radii not be an ellipsoid? As far as I know, ellipsoid is the extension of ellipse into three dimensions, and an ellipse has two radii, so an ellipsoid have three. If anything, I would stick with one and three radii, not two since that is just an arbitrary choise which two axes the radii specify. One of the three axes must be left out, since there are three of them and you specify two only.

glTranslate works fine for placing it, and glRotate works fine for rotating it. But glScale sure works fine for scaling it also. I see the decision to include glScale as parameter to the drawing function but not glTranslate or glRotate as fairly arbitrary though. Why one of them, and not the other two?

Third radius? How should this work? But, firmly spoken, writing own function that would render an ellipsoid will probably take less then an hour. Why won’t you do it if you need it so much? You can be sure though that GLU won’t be updated. I don’t even know why anyone would use GLU, it is probably nice for some basic demos, but in general it is slow, unflexible and clumsy. All this (including the Scale and Push/Pop) are relicts of the past and should be removed in LP IMHO.

Bob, an ellipse is a squashed or stretched circle. An ellipsoid is an ellipse rotated in 3D space on one of its axes. This looks like a squashed or stretched sphere. the cross-section of an ellipsoid is a circle, but changing that to an ellipse varies the shape, so it is no longer an ellipsoid.

Zengar, like I said before, I do not especially need it. It would just seem more intuitive to me to have three radii.

Perhaps I could make my own sphere/ellisoid/object function or module. Of course doing it manually is possible, but I think that GLU could be improved by changing it.

Both Mathworld and Wikipedia disgree on your definition of an ellipsoid, and clearly shows three distict radius constants.

Also, pay attention to Mathworld for example which states that if two radii are the same (basically what you’re defining as an ellipsoid; rotating an ellipse around one axis) is a special case called Spheroid.

But given your definition, you still have the problem of defining which plane to define the ellipse on, and also which axis to rotate the ellipse around. Just specifying two radii isnt enough for that.

Yes, but for the special case of the ellipsoid, two of the radii are the same, which is why it can be described as an ellipse rotated on one of its axes. Note that you could say it has infinite axes, because of this rotation, though I must admit you are right–matematically it is defined using three radii. This is how I’ve been saying it should be called in the function, but for purposes of explanation, I explained it as having two radii rotated, to better show the analog between 2D and 3D.

Yes, but for the special case of the ellipsoid, two of the radii are the same
Did you actually click on Bob’s links? Because they specifically state that an ellipsoid has 3 radii. What you’re describing is a spheroid.

Yes, I did.

I said “ellipse” (meaning squashed circle) and later “ellipse” (including “circle”) then “ellipsoid” (meaning “spheroid”). I think I confused everyone. Until those links, though, I admit I had no idea ellipsoids of three unequal radii were still classified as ellipsoids.

I think you’re confused in which way the definition of ellipsoid goes, and what is special cases of it.

An ellipsoid has, per definition, three independent radii; equal or unequal doesn’t matter, as long as they are independent. That is the fundamendal base case. If two radii are the same, you have a special case called spheroid. All three radii the same, and it’s a sphere.

It’s not that it’s “still called an ellipsoid if they have three unequal radii”, but rather “it’s called other things if multiple radii are the same”. So a sphere and a spheroid is also an ellipsoid. But an ellipsoid is not a sphere or a spheroid.

Right, I confused myself. So, an ellipsoid with three equal radii is a sphere, an ellipsoid with two equal radii is a spheroid, and all radii different is a scalene ellipsoid? Whatever the terminology, an ellipsoid drawing routine would be useful. Incidentally, I’m now familiar with glScale(), and I still think it would be easier to have gluEllipsoid() rather than gluSphere().