PDA

View Full Version : a disk always on top



jyoung77
05-24-2005, 10:02 AM
Hi,

I draw a 3-D model and want to highlight some corner points by drawing a disk on each of these points. The following is my drawing routine. But the thing is that a 3rd party always draw its disks on the top of my disks. I clear buffer before rendering. So I think it must render its disks after mine. I cannot change the order so that make my rendering after its. Is there a solution? Please advise. Thanks.

Tony

// Draw a disk on a point located in x3D
double x[3];
if (gluProject(x3D[0], x3D[1], x3D[2],
mvMax, projMat, viewport,
&x[0], &x[1], &x[2]) == GL_FALSE)
return;

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D (0.0, viewport[2], 0.0, viewport[3]);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glTranslated(x[0], x[1], 0.);
gluDisk(....)
..
popup matrices...

PickleWorld
05-24-2005, 10:30 AM
So your problem is that you draw and then this "3D party" draws after and draws over your stuff? Are you sure this is the case? Have you tried just clearing the frame buffer (and then disabling your draw) to see if the 3D party is in fact drawing these disks?

If so, it is really hard to give suggestions without some more information. Why not just disable the 3D party draw? Do you need it for something? Other than that it is going to be difficult to prevent it from drawing over your stuff.

You could try calling...

glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

after your draw routine which will disable writing to the frame buffer. However if you need any of the information drawn by this 3D party then this won't work (it also won't work if the 3D party makes the same call using GL_TRUE before drawing).

jyoung77
05-24-2005, 12:40 PM
Hi PickleWorld,

Thanks for your reply.

I'm sure the 3rd party renders the disks over mine. Actually, their disks are ok except for only one color. My project is to draw disks with different colors over their disks. There is no way for me to change the order between my rendering and its. I guess the current order may be that it renders the model first, then passes control to me for rendering, then it finally renders the disks for highlighting. It's just my guess.

Tony