Originally posted by OneSadCookie:
[b]Step 1. Learn to program.
Step 2. Learn OpenGL
Step 3. Hard work
Step 4. Bug everyone on OpenGL advanced forum
Step 5. Modeller!
Please go back and do steps 1-3.[/b]
Actually you missed two steps
Step 0.5f. Learn how to use Google.
Step 0.75f. Learn how to look things up.
I have a co-worker that I supervise and he suffers from the same problem I see in this post. Rather than try something himself, rather than use what is given to him, rather than look for the answers himself, he just keeps asking until the exact answer is given to him. And I am seeing this here.
The really sad part of it all is, your problem is very, very simple. Even having not written such functionality you should be able to figure it out in a matter of minutes.
What you want to do is map screen coordinates to x,y,z. Presumably you have a quad view (or even a single view) which is displaying a view that is perpendicular to a plane (eg. x=0, y=0, z=0 are the standard planes).
The view(s) being displayed will have a scale that maps a single pixel/fragment to a unit of measurement. The standard is 1 pixel = 1 unit.
Given this, all you need do is map the x/y of your mouse click to the corresponding axes in the view that has been clicked.
For example, if you click at coord 100,100 and there is a viewport of x=0 that spans from 0,0 to 400,300 (quarter view), then you adjust your coords relative to the center of that view (assuming the view is based around the origin).
Your mouse click then becomes -100, -50.
Because you have clicked in the x=0 viewport we know that x=0 and the x/y translate directly to the z/y axes. This makes the coord of your new point x=0, y=-50 and z=-100.
You continue the process, creating a triangle out of groups of 3 points (you can decide how to do this, typically it is done by creating the points for the mesh and then selecting 3 points at a time, and then creating the triangle.
No I will not write the code for you.
Calling people names will get you nothing. Getting off your butt and trying will get you everything.