PDA

View Full Version : a disk constantly facing the user



jyoung77
04-19-2005, 10:09 AM
Hi,

Can someone tell me how to rotate the z-axis such that it will always face outward from the screen (toward the human user)? The reason I ask is I want to draw a disk (gluDisk()) that always faces me no matter how I rotate the model. Please help. Thanks.

Tony

tamlin
04-19-2005, 10:58 AM
http://www.gamedev.net/community/forums/topic.asp?topic_id=205092

Flip z with glScale if required.

jyoung77
04-19-2005, 11:40 AM
Hi,

Flipping z axis is not what I want. I have a mouse move event handler that rotates the model in response to the mouse moving. However, I want to draw a disk (using gluDisk()) that always faces toward the user from the screen. To draw this disk, I need to do the following. The question is about how to feed parameters to glRotatef(....) below.

glPushMatrix();
glTranslatev(v); // the disk's location
glRotatef(....)
gluDisk(qobj, 0.0, fRadius, 4, 1);
glPopMatrix();

Thanks.

Tony

zed
04-20-2005, 12:02 AM
perhaps
glPushMatrix();
glLoadIdentity(); // reset the modelview matrix
glTranslatev(v); // the disk's location;
gluDisk(qobj, 0.0, fRadius, 4, 1);
glPopMatrix();

jyoung77
04-20-2005, 10:43 AM
Hi,

I tried your way before but it didn't work. It's because the disk won't be in its right position. After glLoadIdentity(), the disk faces you, which is what I want, but its location is at a location without considering the original rotation effect. Maybe I can recaulcate the disk location before glLoadIdentity(). But I don't know how.

Tony

knackered
04-20-2005, 11:29 AM
And you've posted this in the *advanced* forum because....?
You can't possibly, not even for a minute, consider this advanced? Even someone without any prior knowledge of computers couldn't imagine that making a disk face the viewer could be construde by anyone other than their grandmother as an advanced graphics question...
I'm astounded zed has tried to help you. You should be very grateful.

dorbie
04-20-2005, 12:08 PM
This is not an advanced question, and your identical post was answered in beginners the day before you posted here. If you need additional info in a thread then ask for it, but please don't repost/crosspost.