Drawing a rectangle using two mouse clicks


I’m trying to draw a rectangle using two mouse clicks, over an existing BMP image.

So what I would like to happen is that the first click designates where the top-left of the rectangle will be, and then the second click designates where the bottom-right of the triangle would be.

Any and all help is very welcome and appreciated!

grab both points screen x,y positions from the user input

then setup a 2d orthogonal projection, so the window corresponds to a 1pixel == 1 unit mapping ( check the faq or red book or wiki )

  • then its just drawing a quad with