gluUnProject?

Hey all, I’m trying to RTFM on something, but not sure where in the manual to look, lol.

I’m trying to implement a very simple LOD on bezier or parametric curves, where the number of divisions is sub-pixel. I figured a simple way might be to define that in terms of distance in screen space. But, how does one project form a world coordinate to a screen coordinate?

Is gluUnProject() what i’m looking for? i was reading the man page and wasn’t quite clear. if this is the tool i need, i can investigate further on my own, but wanted to know if this is what i’m looking for.

thanks

gluUnProject may do what you’re looking for, but it’s intended more for implementing pick results with mouse clicks. A much better approach would be to read in the manual how vertices are converted from world space to screen space. It should be in the beginning of the spec, near where they describe the matrix stacks, viewport sizing and glVertex calls.

Off the top of my head, this is how I think it works:

  1. Object space coordinate is transformed by combined modelview matrix
  2. Then transformed by the projection matrix
  3. x,y,z components are divided by the 4th homogenous coordinate
  4. Recentered and scaled to match the dimensions of the viewport

I’m probably being too vague and missing some steps, but that’s the basics of it.

thanks for taking the time to outline that. i think that gives me the clues i need. thanks.