drmoose.net

BlenderGL

Never hand-code shapes again

Sample output from BlenderGL If you’re going to became a computer scientist, there’s a good chance that you’ll eventually have an opportunity to take a class on computer graphics. If that opportunity arises, take it, because computer graphics are cool. If your class is like mine, then chances are you’ll be required to demonstrate your knowledge of translation, rotation, and scale by making a bunch of objects dance around the screen. If you want your objects to be more interesting than the ones glut can generate automatically, you must either prepare for several hours of hand-coding polygons like the one to the right, or download a tool like this one.

BlenderGL is not one-of-a-kind. I’ve heard tell of several others, such as BOGLE and this one on the Blender forums, but this works for me. If you’ve written one too, let me know and I’ll update this page. Here are some incomplete sentences that, perhaps, make mine a tad more useful than others.

Features

  • Exports C/C++ code that compiles and runs on Windows, Mac, or Linux.
  • Uses vertex normals to get OpenGL’s built-in shading to correctly render objects set as “smooth” within Blender.
  • Correctly generates separate header and source files to reduce compilation time for people using makefiles or IDEs.
  • Name of the C function is based on the name of the object in the Blender scene.
  • Public Domain. No copyright restrictions on modification or redistribution.

When NOT to use BlenderGL

  • When you’re a student and you haven’t asked your professor’s permission first. I can’t imagine anyone thinking this was cheating, but you never know.
  • When you need high frame rates. BlenderGL does absolutely no optimization of any kind, and there are better ways of loading objects into OpenGL programs. If you’re willing to do a little more programming, try starting with Aleppax’s Edge stripificator.

If I haven’t scared you off yet, Download version 0.1 (Requires Blender.)

Created on 15 Jun 07. Last edit 19 Dec 07 by Dan.