coordinates problem

hi,
i would like to know the coordinates of my object at clicked point.for this i use gluUnProject() function.

i have declared glortho as

glortho(-180,180,-90,90)

it is showing xcoordinates from -180 to 180 correctly. but it is showing y coordinates faultly from -112 to 68. can anyone help me why this is happening like this.

thanks and regards
k. bhogasena reddy

I remember a long time ago, I had the same problem. I was using Qt. I used a QGLWidget embedded in a QMainWindow to draw with OpenGL. The problem is that I have used the screen coordinates of the QMainWindow and all my screen coordinates was 22 pixels too low. This appear to be the height of the tool bar of the QMainWindow. After I used the screen coordinate of the QMainWindow child widget and my screen coordinates was now ok. So 90 - 68 = 22 pixels. Maybe you made the same mistake.

Can you post some source code to verify?

yes,
it’s working now. thanks for u r reply.

and i have one more question. i rendered filled concave polygons. how to render outerlines for those.

To render outlines, use the primitive mode GL_LINES. You may also need to look at glPolygonOffset to avoid z-fight, or render your object a little bit bigger with GL_LINES mode.

yes,
i rendered using LINE_LOOP. but i don’t know is it correct method or any alternative