Main Content

OpenGL / C / C++ - an example to get you started

Archive - Originally posted on "The Horse's Mouth" - 2011-01-26 07:54:39 - Graham Ellis

A Computer Graphics application in C / C++ - that's the coding that one of my delegates is going to be doing for her "real work" after this week's course, and I found myself looking back to old times - when I used (amongst other things) to subcontract to Silicon Graphics to present courses on their GL Library - the forerunner of OpenGL.

It's surprising just how quickly things come back - this graphic was a quick example that I played with, setting up an image, drawing some vectors onto it, and swapping my buffers - the Silicon Graphics system was almost always double buffered, and (joy of joys) addressable with world rather than pixel co-ordinates.

The pretty pattern shown here is quite a short program - a "hello graphics world" example that I wrote to show a very simple program, and all the libraries, etc, that were needed at load time for it to work on my system (Xcode on Mac OS X). Source is [here] and includes my load line so that you - if you have a similar environment to mine - won't end up having to play "hunt the include file" and "hunt the library".