tags:

views:

1191

answers:

3

how to draw a polygon by mouse with openGL in c++

+4  A: 

Maybe go to class, pay attention, and learn what the teacher says? Or look at the NeHe tutorials, which you can find through five minutes of using the almighty Google?

mmr
+8  A: 

Start by conditioning the mouse to recognize the shape of a polygon and be able to complete one it sees on a computer screen. You can use operant conditioning (by rewarding the mouse with a food pellet) to train it to an acceptable level of proficiency.

Marc Charbonneau
Note to self: do not eat cereal while reading SO answers. :)
Jim Buck
lol I was gonna downvote before a I realized this was a homework question, +1
hasen j
+3  A: 

Assuming this is homework, and that you want to try to figure this out for yourself before looking at someone else's solution, take a moment to think about:

  • How do you know when the user push a button?
  • What are the mouse coordinates at that time?
  • How do you translate the mouse coordinates to the world coordinates of your GL-model?
  • How do you figure out which vertex to move? (or add)
  • How do you move the vertex?
  • How do you redraw?
  • What is the connection between model and view?
Rolf Rander

related questions