Archived

This topic is now archived and is closed to further replies.

Dragonus

Rendering with GL_FEEDBACK

Recommended Posts

I was looking through Lesson 33 because I''m needing mouse support for an OpenGL app that I''m writing. Pretty much what the app is going to do is display a (real) map section (with real latitude and longitude coordinates), and it''s the program''s job to figure out the latitude and longitude of a point that you click on the map. (You''re given the coords of the corners of the map, and we assume that the Earth is flat.) The problem lies in how to get the lat and long coords. Using glRenderMode(GL_SELECT), I can get select the map polygon correctly (albeit, it selects it at the wrong depth). However, I really need to find the 3-D coordinate of the map that I''m given. (a.k.a., if I click on window coord {456, 834}, I get back the OpenGL coord {-60, 158, -100}.) Looking through the glRenderMode() function, GL_FEEDBACK seems to be the perfect mode as to find out the x and y coordinates clicked on a polygon, given that polygon''s z-coord. However, I haven''t found an example for it, and my co-worker simply wished me "Good luck" after I mentioned GL_FEEDBACK to him. Is it possible for someone to write me a quick code snippet of how to that? I will treat you as an OpenGL god for the rest of your life. (halfway-j/k) Thanks in advance, ~ Dragonus

Share this post


Link to post
Share on other sites
Alright, now that I know how to work GL_FEEDBACK, and now that I know that GL_FEEDBACK isn''t what I want to use...

How would I go about doing what I need to do?

~ Dragonus

Share this post


Link to post
Share on other sites
Keep track of the mouse cursor position yourself (there are other benefits to that as well). With the knowledge of a specific mouse X,Y position, and the knowledge of the map position relative to the screen, you should be able to calculate the mouse''s current position (on the map) at all times.

Share this post


Link to post
Share on other sites