coordinate

I have some OpenGl question(I use VC6.0 to develop MFC program):

I want my program to display a Bezier curve, then use mouse to locate control-point. So control-point would be display at the position that mouse point to. In the mouse-message, “CPoint point” regard left-top angle of the window clientarea as coordinate
origin (0.0), use pixel as unit. But in some sample Bezier program, control-point use the center of the clientarea as coordinate
origin (0.0), and I don’t know what is its coordinate unit.

What is the proportion relation between this coordinate unit and pixel?
Which variable is clientarea’s length and width stored in?
How to get the variable in mouse message process function?

please help me, thanks.

[b]
What is the proportion relation between this coordinate unit and pixel?

Which variable is clientarea’s length and width stored in?

How to get the variable in mouse message process function?
[/b]

Try orthogonal projection. Your client area will be: -1…+1 in both directions. Then a just a little scale trick and you have screen coordinates.

E.g.

glViewport(0, 0, 640,480);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity(); //otrhogonal projection

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glScalef(2.0f / (float)640, -2.0f / (float)480, -2.0f/Zmax); //this is the conversion

To get the client area’s size you can ask it from windows. I am not familiar with MFC, but there must be some GetWindowRect like that member function.

I hope I could help you.