Bresenham’s Line Drawing Algorithm in C

at 10:35 pm

While working on a project for graphics, I needed some information on Bresenham’s line drawing algorithm, a.k.a. the midpoint line drawing algorithm, most specifically doing it in C for OpenGL. There was pretty much little or bad information out there or it was some parts making sense, others not. Here is my rendition of the algorithm:

http://crackinwise.pastebin.com/f65383521

This is a C-language version of the code that uses OpenGL points to draw the line. This is just the line drawing algorithm, so if you want to use this in any sort of OpenGL application, you will need to write the rest of your own OGL application.

Good stuff.

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Leave a Reply