PDA

View Full Version : how to have a fixed size disk?



jyoung77
04-25-2005, 01:52 PM
Hi,

I want to draw a disk with a fixed radius (in screen pixels) so that it always looks the same size no matter how you zoom-in/zoom-out or change the window size. Unfortunately I don't know how the 3rd party software zoom-in/zoom-out (either change scaling factor or viewport??). I tried the following but the disk size does change while zooming. Can anyone give me a hint? Thanks.

glPushMatrix();
glLoadIdentity();
gluDisk(qobj, 0.0, .01, 10, 1); // radius .01
glPopMatrix();

Tony

shinpaughp
04-25-2005, 05:55 PM
It is likely that the scaling is affecting the other matrix. Try:

pseudocode:

glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glOrtho( ..... );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
gluDisk( ... );
glMatrixMode( GL_PROJECTION );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glPopMatrix();

You get the idea...