For my senior research, I knew I wanted to work with graphics programming, in particular, OpenGL. With the help of some friends from Make Hartford, I came up with a research project that did just that. What we came up with was an experiment where OpenGL performance was compared across different operating systems.
The Research Project
I built a simple benchmark where every second, a rotating cube was added to the scene. At the same time, the frames per second (FPS) were recorded, and saved as a comma separated values (CSV) file. Next, I ported the code to three operating systems (Windows 10, Fedora Workstation 29, and Mac OSX El Capitan), and ran the benchmark five times. I then cross compared the results to assess the performance of OpenGL across these three operating systems.
Programming the Benchmark
The goal of porting this code to Windows, Mac, and Linux made me decide to go with a Linux/Unix development environment. Since OSX is a Unix fork, and Linux is, well, Linux already, these tools more or less worked out of the box. To get this environment in Windows, I used Cygwin. I wrote the code in c++, compiled in gcc/g++, and used makefiles to manage the build environment. I also wrote a simple BASH script to help with system specific compilation (each OS was given a unique makefile, and this script would run the OS appropriate file), and to manage running the benchmark.
For the OpenGL portion, OpenGL has two major programming styles. First is an older “fixed function” pipeline, and a newer shader based pipeline. In the early days of graphics hardware, graphics cards had fewer features, and the fixed function pipeline was designed around this. Newer graphics cards support shaders. These are simple programs that are run in massive batches on a graphic card. I wrote a shader based program in OpenGL 3.3, mainly because I readily found quality learning material for this newer style.
Included in this benchmark was a simple function that counted and recorded the frames per second (FPS) every second and output this record to a CSV. I did this because I knew that I could open a CSV in Microsoft Excel, and I didn’t want to spend time integrating an external graphing library into my program. So I wrote a simple function that wrote CSV files, and kept it at that.
Setting up the Test Hardware
First, I had to set up my test computer. I was running this benchmark on OSX, Windows, and Fedora. So, I chose an old Macbook Pro that I had. It was a late 2011 model with an Intel HD Graphics 3000 integrated graphics card. This was because OSX can’t be run on non Apple hardware without some hacking. Seeing how I had the hardware already, I choose to just use the Mac to run all three systems.
Triple booting three operating systems was a bit difficult, seeing how I’d never even done a proper dual boot. But, with some help from the people of Make Hartford, we got all three working. It currently runs with a combination of the Mac’s boot manager and GRUB. However, with some simple modifications, GRUB should be able to boot all three.
Unfortunately, the results weren’t super flashy. I could only get the benchmark working on Fedora.
First, OSX has deprecated OpenGL in favor of Apple’s proprietary Metal API. The lack of support for OpenGL and related tools effectively throttled OpenGL to version 2.2. Since I targeted OpenGL 3.3 with my benchmark, I couldn’t run it on OSX.
For Windows, the Intel HD Graphics 3000 was no longer supported, and the drivers were limited to OpenGL 3.1. So again, I couldn’t run the code. I was, however, able to run my benchmark on my Windows based development computer.
While I wish I could’ve messed around more and got my program working on all three systems, I simply ran out of time. This was hardly my only project and it was becoming a bit of a time sink, so I had to make the decision to hand it in as is. Thankfully, my professor was more than understanding.
But, I’m glad that I did it. I went into this project cold, barely knowing anything about OpenGL. I learned a lot about OpenGL, and some things about PC hardware and operating systems. Further, the point of failure of this project was the older hardware of my test computer. My OpenGL code worked fine, which was my main reason for choosing this project. Next time I work with OpenGL (or another graphics API), I’ll be able to design a much more solid project. Further, if you want to see the source code, it’s available on GitHub.