Opengl move vertice with mouse

Hi,

I am testing opengl and i would like deform polygon by moving vertice with mouse.
Do you have an example for this please ?
Thanks for your help

Not sure if this is exactly what you are looking for, but it could be a starting point for vertex selection…

http://www.real3dtutorials.com/tut00010.php

This project might also be helpful…

https://github.com/alwyn1024/x3-vectorjam

thank
tuto00010.php is good for retreive object but i need to move it with mouse cordonnees
for your project, what file can i open with it ? it start without polygone
thsnk for your help

Ok i can retreive polygone with mouse
Do you know formula to convert xy coordinate mouse to xyz coordinate 3d opengl ?
With this i’ll can move my polygone
Thank you

Hi Jean-Marc,

Mapping 2D mouse coordinates to 3D space can be tricky.

In my projects I do my rotations with Quaternions. In the VectorJam project above, have a look at the X3_RotateWithXY method to see how I convert a 2D mouse position into a quaternion that I then use for calculations in 3D space.

Also have a look at the VJ_AdjustMoveX method. With this method I move polygons up and down on the x-axis using the mouse coordinates.

Unfortunately there is not an easy and simple answer (that I know of) to map 2D coordinates into 3D space for movement.

Hope this helps…

Hi,

You need to select/define a method to convert the 2D displacement into a 3D displacement. At work I use Autocad and what it does is moving the object I select within the plane of representation (the plane of the screen). If you wnat to move the point in the third direction you need to rotate the view.

There is no unequivocal conversion from 2D to 3D.

Julen