View Full Version : coordinates problem
01-30-2009, 05:20 AM
i would like to know the coordinates of my object at clicked point.for this i use gluUnProject() function.
i have declared glortho as
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
01-30-2009, 10:39 AM
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?
02-01-2009, 12:34 AM
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.
02-01-2009, 03:53 AM
To render outlines, use the primitive mode GL_LINES. You may also need to look at glPolygonOffset (http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml) to avoid z-fight, or render your object a little bit bigger with GL_LINES mode.
02-02-2009, 07:09 AM
i rendered using LINE_LOOP. but i don't know is it correct method or any alternative
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.