PDA

View Full Version : Rotate A View



Swift
11-20-2003, 07:19 AM
I had done some drawing with OpenGL and want to rotation the view, so that I would be looking at the view from the back.

Presently method I am using is to rotate the view on the y-axis by 180 degree. But in some of the drawn picture, half of the picture is gone after the rotation.

It seems like I had not execute the rotation command correctly. What is correct method for rotation of a view? And is there another method to view the back of the drawing. Thanks.

soconne
11-20-2003, 07:23 AM
It depends on where you drawing your object. If you're drawing the object with z values of "0", then you should probably call glTranslate with some z value to back up the camera. For instance:

glTranslatef(0,0,-5);
glRotatef(roty,0,1,0);

-5 can be any value that will correctly fit your object into the view.

mithun_daa
11-20-2003, 09:12 AM
Originally posted by Swift:
I had done some drawing with OpenGL and want to rotation the view, so that I would be looking at the view from the back.

Presently method I am using is to rotate the view on the y-axis by 180 degree. But in some of the drawn picture, half of the picture is gone after the rotation.

It seems like I had not execute the rotation command correctly. What is correct method for rotation of a view? And is there another method to view the back of the drawing. Thanks.

" But in some of the drawn picture, half of the picture is gone after the rotation.."

lookz like ur viewvolume is not big enough to accomodate the whole scene after rotation. or could translate it as recomended by the other person here.

Swift
11-20-2003, 10:19 PM
The solution provided is great. I had gltranslate the view to -7. But this cause the initial zoom function to be wrong. I would try correct the rest of the code.

Is there another method to flip a view other than to rotate the view?

Thanks.