PDA

View Full Version : gluProject (yes, yet again)



Super-K
01-16-2002, 04:21 AM
I have searched through the forums and I've looked around the 'Net but I have yet to find the information I seek so excuse me if this has been asked before... (I know similar questions have, but I never really saw any answers)

I'm currently working with an application that has axis lines going from -1000 to +1000 on each axis. I'm trying to find the intersection of each line with the side of the view window so I can stick a 2D label there.

Now, I've tried using the feedback buffer. That is the easiest method, but it doesn't seem to work with many of the GL cards out there. Maybe I don't know enough about the feedback buffer but it seems like some cards just plain don't support it.

So that leads me to gluProject. I have no problems finding the screen coordinates of any visible point, it's the off-screen stuff that I can't get to work. As I said, I have points way out at +/-1000 on each axis, these points are almost always off-screen. What I don't understand is the math behind pluProject. The coordinates it gives me seem "wrong" (I know it's probably correct, I just don't understand the issues) in relating to what I would think it should give me.

For instance, if I look at the X-axis, which is coming "towards" me, then it goes off to the lower right of the screen, why does gluProject tell me the screen-Y-coordinate is +1600 (or some positive number) when it's obviously going "down" in relation to my screen. I would think the screen-Y-coord would be some negative number since it's lower than the bottom of my screen. When this happens, I noticed the Z-coord from gluProject is < 1.0 (this seems to happen when the axis lines come "towards" me then off the screen). What is that Z-coord for anyway? That is like some sort of secret since no-one ever seems to say what it is for (even the documentation).

I hope that makes sense, I can try to explain better if needed... or give more details of my problem.

Super-K
01-16-2002, 04:30 AM
I want to make sure I'm clear on something.

When I said the screen-Y-coord was +1600 I don't I mean that I expect a negative number just because it's going "down" in relation to my screen. The axis line goes down and off to the right of my screen. gluProject returns a screen-Y-coord of +1600 which would be way, way higher than my screen window when it seems like it should be going the other way.

Maybe that's not any clearer... hehe