need some help with stencil test.

Hi!

I have writed a program that draw a 3D object.  I can zoom on my object, look at it from different view select it...I also have a ruler allowing me to take a measure between two point on the object.

My problem is that I don't know how to  fix my ruler so that it doesn't rotate while I rotate my object. But the ruler have to follow the object when I zoom in or out to keep proportion.

thank’s for helping

Well you could use glGetDoublev function to get the modelview matrix, take the inverse of that, and multiply this inverse matrix to your ruler. Now this will undo all transformations, so to make it still follow the object after it zooms in or out, after the inverse transform, do a glTranslatef to position it where the object is.

-SirKnight

[This message has been edited by SirKnight (edited 09-09-2002).]

Or… use glPushMatrix/glPopMatrix. When you draw the object first push the matrix, do any transforms, draw the object, then pop the matrix back off the stack. Then draw your ruler and use translate to position it. This will be better than my other method, and faster.

-SirKnight