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 @flexibits: Happy 1st Birthday, Fantastical! http://t.co/bIcVDgbZ 2012/05/18
- @IAmReynolds thanks, I think it's the color choice that made it look good. Gradient colors similar to the line color. 2012/05/17
- @rwenderlich I'm interested if this is still an option. I did a text-based risk game back in high school. It could work for an iPad app. 2012/05/16
Github
Tags
animation App Store Artwork Evolution Boost Boot Camp C++ cross platform development Dual Monitors function pointers Gears of War 2 gestures git GLUT inheritance iOS iPad iPhone Macbook Pro Mac OS X MacPorts member functions Objective-C OCUnit OpenGL player/stage polymorphism presentation programming remote control RIT SCM slides static methods STL svn 1.6 tdd testable code testing unit testing version control Windows XP Xbox 360 Xcode xcode 3.1.2








[...] 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!