GLUT Object Oriented Framework on Github
In 2009 I took a Computer Animation course at @RIT I created an object-oriented C++ wrapper for GLUT. The idea was to create a set of classes that could be reused for each of the separate project submissions. The main class wraps around the GLUT C-style functions and provides a class that can be inherited from, to provide application specific functionality.
The idea was to make the boiler plate code disappear and make it easier for novice programmers to get an animated graphics window in as few lines as possible. Only four lines of code are needed to get the window running at 60 frames per second. You can subclass the framework and implement your own OpenGL animation or game project.
Edit (8/22/10): You don’t need to use pointers, I’ve updated the code example with working code.
// main.cpp #include "GlutFramework.h" using namespace glutFramework; int main(int argc, char *argv[]) { GlutFramework framework; framework.startFramework(argc, argv); return 0; }
The code uses a cross-platform (Windows/Mac tested) timer to create a constant frame-rate, which is necessary for animation projects. It’s under the MIT License, so feel free to use it as you see fit.
http://github.com/PaulSolt/GLUT-Object-Oriented-Framework
An Xcode 3.1 and Visual Studio 2010 project is hosted on github to support Mac and Windows. There is no setup on the Mac, but Windows users will need to configure GLUT. I plan on posted tutorials on how to get setup on both platforms. For now, look at the resources section below.
Resources:
- Previous Post: http://paulsolt.com/2009/07/openglglut-classes-oop-and-problems/
- GLUT for Windows: http://www.xmission.com/~nate/glut.html
- Visual Studio and GLUT setup: http://www.cs.uiowa.edu/~cwyman/classes/common/howto/winGLUT.html
- Old Post on GLUT in Eclipse: http://www.paulsolt.com/GLUT/
6 Responses to GLUT Object Oriented Framework on Github
Leave a Reply Cancel reply
Artwork Evolution
Facebook
@PaulSolt
- RT @joshgrenon: Encourage Users to Restart Your App http://t.co/98xCvoU1 11 hours ago
- RT @featherless: Writing up the bundle resources portion of the iOS Framework article now :) https://t.co/82BAI9zZ 14 hours ago
- RT @michaelmurphy: Everybody loves @RocBrewingCo! RT @toddjclausen: Samuel Adams makers aid local brewers http://t.co/HEo83QDT 14 hours ago
Github
Tags
animation App Store Artwork Evolution Boost Boot Camp C++ cross platform default values development Dual Monitors function pointers Gears of War 2 git GLUT graphics ImagineRIT Impulse inheritance iOS iPad iPhone Macbook Pro Mac OS X MacPorts member functions Objective-C OpenGL PAX 10 player/stage polymorphism programming remote control RIT Robot robotics SCM static methods STL svn 1.6 version control Windows XP Xbox 360 Xcode xcode 3.1.2 XNA








[...] Update: 8/22/10 Checkout the updated framework and post: http://paulsolt.com/2010/08/glut-object-oriented-framework-on-github/ [...]
hey Awsome, script learning glut and openGl this is gonne be great reference for a Object oriented approach, thanks!
Amazing work
I was about to do just about the same thing and I stumbled upon your work when I googled for the issues with setting up GLUT’s callback functions that I had put inside my graphics class. So instead of building my own OOP design around GLUT and OpenGL I can use yours right away =)
Cheers!
@Sebastian I’m glad it helped you get started!
Thank you! After struggling for hours on this problem, I finally stumbled upon your code. Quite helpful to get mine working. I had significant trouble with specifying the callback functions for glut, without actually writing them in the class.
Thanks!
glad to help!