Solved

OpenGL and MFC - Lclick coordinate

Posted on 1997-09-21
4
321 Views
Last Modified: 2013-12-03
I have a 2-D grid on a window. When the user left clicks on
the space of the grid, I need to get the coordinate that was clicked in the OpenGL projection, not the pixel coordinates
of the window passed in Cpoint of the OnLButtonDown(UINT nFlags, CPoint point).

I need help finding those corrindates so that the user can create an object where he just clicked.
[Using Visual C++ 5.0]
0
Comment
Question by:vinny5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:vinny5
ID: 1406969
Edited text of question
0
 

Author Comment

by:vinny5
ID: 1406970
Edited text of question
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 500 total points
ID: 1406971
When displaying the grid, don't you keep track of the origin of the grid and the projection matrix? If so, then you can apply the projection matrix to the point after adjusting for the origin of the grid. This will give you the translated point.


0
 

Author Comment

by:vinny5
ID: 1406972
Thanks, but I still dont exactly know how to apply the projection matrix to the point.  But I see what your saying, I have the superbible and I havent seen an example like this. If you havent noticed im a begginer of OpenGL, and MFC.

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question