CodeBits

Various bits of C++ code from things I've written. Hope they're useful :)

 

Fractal Noise (subdivision)

C++ class for producing fractal terrain heightmaps (amongst other less interesting things ;).

Uses the quick & simple recursive subdivision method, which although not the best algorithm (it can produce quite visible 'creasing' artifacts at low frequencies), is fast and easy to understand.

 

OpenGL Text Drawer

C++ singleton class for drawing text in OpenGL.

As you may be aware, drawing text in OpenGL isn't the easiest thing to do! This class creates a singleton object that makes it easy for you :) See the .h file for usage instructions.

This code was originally based on NeHe tutorial 17 (the fount of OpenGL tutorials;).

Note: this code requires that a texture be resident containing font characters. See Bitmap Font Builder for a nice app that makes these. I also advise the use of some form of texture manager - see Gamedev.net for a good example.

 

OpenGL Text Queue

C++ singleton class for drawing a text queue in OpenGL.

This class draws a queue (STL) of text strings using the text drawer class above. This class is a bit more specific than the text drawer, but still quite useful where you want e.g. a log of game events, and can be converted into a regular class quite easily. See the .h file for usage instructions.

Note: Requires the text drawer class above.