OpenGL Bersenham Algo

I'm an enginnering student, our lecturer has ask us to create an opengl app tat shows the bersenham
so far i have derive the algo and the pixels...but i don't know how to draw a line between those pixels..
this is what i have so far

PS: Did you write the entire code on your own or was it provided by the professor? Because i see that you are setting up the projection matrix right. What exactly are you getting wrong? Uploading a pic may illustrate better.

so i manage to do till the mouse clicking but the lines are drawing in a totally diffrent places

Hi,

I hope you are aware that the window's origin would be the top left corner. So, when you click on the window, the coordinates returned in your mouse callback would be w.r.t the top left corner. Maybe this is causing the problem?