Click to See Complete Forum and Search --> : how to update opengl window from mfc dialog


dathatreya
April 21st, 2008, 05:38 AM
Hi

I have created an opengl child inside and mfc dialog.you can refer link:
http://www.codeguru.com/cpp/g-m/opengl/article.php/c5583/.
Now I included two edit boxes at the side of the opengl window and a button.
Now my question is how to make movement for the triangle from the edit boxes (The edit boxes are x,y coordinate values ).Once I enter the x,y values and press the button the triangle should move according to the given x,y coordinates.

can any one give the solution.

bitshifter420
April 24th, 2008, 03:25 AM
Basically what to do is, when the button is pressed and released, we want to aquire the text in each of the edit boxes and convert them to decimal,
(via sscanf). You can use 'Invalidate' to notify the rendering window that it needs to redraw itself. Then use these values to modify the current 'glTranslate' or 'glRotate' values.

Mike Harnad
April 25th, 2008, 09:07 AM
You can get the contents of the edit boxes in a few different ways. The easiest would be to define a member variable for each edit box. Then call, UpdateData () to retrieve its value. Make sure to invalidate the window after you've update updated the matrices.