glRotate( X, 0, 0, 0 ) changes object's size...

G’Day Guys & Gals…

I noticed when glRotate has zero values for X, Y & Z, it gets all confused and resizes the object instead.

This is actually pretty cool!
glRotate( 0.0f, 0.0f, 0.0f, 0.0f ) does nothing.
glRotate( 60.0f, 0.0f, 0.0f, 0.0f ) makes the object half it’s size.
glRotate( 90.0f, 0.0f, 0.0f, 0.0f ) makes the object shrink to nothing.
…then it starts getting bigger again upside down
glRotate( 180.0f, 0.0f, 0.0f, 0.0f ) back to normal size.
glRotate( 270.0f, 0.0f, 0.0f, 0.0f ) shrink to nothing again…
…and so on.

You can call successive resizing glRotates that compound on each other…

  • Move to position
  • Draw Object //(appears to be 400 pixels wide on screen for example)
  • stay in the same place, don’t translate
  • glRotate( 60.0f, 0.0f, 0.0f, 0.0f )
  • Draw Object again //(inside the 1st is a 2nd that appears to be 200 pixels wide)
  • don’t move anywhere
  • glRotate( 60.0f, 0.0f, 0.0f, 0.0f )
  • Draw Object again //(inside the 2nd is a 3rd that appears to be 100 pixels wide)
    and so on…

You can even do normal glRotate’s, mixed in with resizing glRotates and it all works sweet…

  • Move to position
  • glRotate( 45.0f, 1.0f, 0.0f, 0.0f ) //Rotate angle
  • Draw Object
  • glRotate( 60.0f, 0.0f, 0.0f, 0.0f ) //Resize object to half
  • Draw Object
  • glRotate( 45.0f, 1.0f, 0.0f, 0.0f ) //Rotate angle more
  • glRotate( 15.0f, 0.0f, 0.0f, 0.0f ) //Resize a bit more…
  • Draw Object

So here’s my question…

I have an object of a fixed size (eg. radius = 1.0f) and is contained in a Display List so I don’t have the luxury or desire to keep changing each object’s radius for each draw.

I’m putting an object inside an object inside an object etc…
so each has to be smaller than the other, eg. each is half the size relative to its parent.

I don’t want to send it off into the distance to create the illusion it is smaller or it will no longer be inside another.

I believe glScale will do the job for me, but everywhere I look everyone says it slows things down as normals and more have to be heavily recalculated,
and I don’t want to have to calculate how much I have to rescale each object anyway…
(eg. 50% for 2nd generation x 50% of that for 3rd generation x 50% of that for 4th generation etc…)

It works, and it’s working cool bananas for me.
But will it work on everyone’s machine?

Is this a quirk/bug/feature of OpenGL or just my version?

Is this quicker than glScale?

Anyone possess the supreme omnipotence to satisfy this hopeful soul?
…or anyone else can confirm that this is cool/safe to base my future marriage to OpenGL on?

Thanks for yout time dudes…

Read the OpenGL programing guide appendix F on homogenous transformations.
A null vector in the glRotate parameters is hardly defined, e.g. there is a v/norm(v) involved. 0/0 anyone?
If that is calculated to 0, only the cosine of the angle will remain in the diagonal of the matrix and that is a scale matrix. There you go.
Don’t do this, behaviour is undefined!

Using glScale needs glEnable(GL_NORMALIZE) to result in correct lighting. The normalization done in hardware today and should not cost too much.
Building a glScale matrix is simpler than a glRotate, but after that, there shouldn’t be a difference. Use glScale if you mean “scale”.

You should try what is faster, calculating the vertices of the smaller models yourself and only storing geometry inside the display lists (bigger, but fewer trafos) or what you do.
I’ve seen applications placing cubes with such transformations and performance just sucked.

Doesn’t it make you feel dirty to even remotely consider this type of abuse? If not, shame on you! :slight_smile: