Zovirl Industries

Mark Ivey’s weblog

Humble Beginnings: Your First OGRE Application (for linux)

Nicholas Green’s Humble Beginnings tutorial for the Ogre graphics engine says “Under construction” for the Linux section. This is an attempt to remedy that. I’m only going to cover setting up the project and getting to a basic program which compiles and runs, similar to the Mac OSX section. After that, you’re on your own…

To begin, make the Samples/Space directory for your project and copy these files into it:

Next we will set up a basic build system, for which we are going to use GNU automake and autoconf. If you want to learn more about these tools, I suggest reading the excellent tutorial at the autotools website. First we will write Samples/Space/configure.ac, which tells autoconf which programs and libraries we are going to use to compile our application:

AC_INIT([Ogre Space Tutorial],
        [0.0.1],
        [Mark Ivey zovirl@zovirl.com],
        [Space])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([dist-bzip2])

AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL

PKG_CHECK_MODULES(OGRE, OGRE >= 0.14.1,,AC_MSG_ERROR("OGRE not found!"))
AM_CXXFLAGS="$AM_CXXFLAGS $OGRE_CFLAGS"
AM_LDFLAGS="$AM_LDFLAGS $OGRE_LIBS"

AC_SUBST(AM_CXXFLAGS, "$AM_CXXFLAGS")
AC_SUBST(AM_LDFLAGS, "$AM_LDFLAGS")
AC_SUBST(PKGDATADIR, "${datadir}/${PACKAGE}")

AC_CONFIG_FILES([
   Makefile
])

AC_OUTPUT

Most of that is boiler-plate. The two important parts are “PKG_CHECK_MODULES(OGRE…)” which tells autoconf we will be using OGRE (and it should go find the correct compiler flags for us) library and “AC_CONFIG_FILES(…)” which tells autoconf which files we want it to generate.

Next we will write Samples/Space/Makefile.am, which tells automake how to compile our program:

bin_PROGRAMS = Space

noinst_HEADERs= ExampleApplication.h \
                ExampleFrameListener.h \
                SkyPlane.h

Space_SOURCES= SkyPlane.cpp

EXTRA_DIST = bootstrap configure

Ok, the last part of the build system is a short script to set everything up for us, Samples/Space/bootstrap:

#!/bin/sh

set -x
rm -f config.cache &&
libtoolize --force &&
aclocal &&
autoconf &&
autoheader &&
automake --foreign --add-missing

make that executable with “chmod +x bootstrap”

You are ready to compile (from the Samples/Space/ directory):

./bootstrap
./configure
make

Finally, you should be able to go into the data directory (Samples/Common/bin) and run ../../Space/Space.

Ok, the build system is done, now it is time to add the real source code. Remove SkyPlane.cpp and SkyPlane.h and edit Makefile.am to reflect the new files you are about to add:

bin_PROGRAMS = Space

noinst_HEADERs= ExampleApplication.h \
                ExampleFrameListener.h \
                SpaceApplication.h

Space_SOURCES= SpaceApplication.cpp

EXTRA_DIST = bootstrap configure

Finally, add the code for the application’s main loop in SpaceApplication.cpp:

#include "Ogre.h"
#include "SpaceApplication.h"

int main(int argc, char *argv[])
{
   // Create application object
   SpaceApplication  app;
   try {
      app.go();
   } catch( Ogre::Exception& e ) {

   std::cerr << "An exception has occured: " <<
   	e.getFullDescription().c_str() << std::endl;
   }

   return 0;
}

That won’t compile just yet because SpaceApplication.h hasn’t been added, but you are ready to continue on with the rest of the tutorial. Enjoy…

Permalink

This plugin helps you use a consistent permanent link format by generating permanent links for you. It does this by exporting two variables, $permalink::story and $permalink::category, which contain the permanent link for the current story and category, respectively. It also provides a function permalink::get_link() which can be used by other plugins when they wish to get a permanent link for a file.

I also have some patches for blosxom.cgi and some other plugins that make them use permalink:

Download permalink 0.0.1

Documentation is available here.

Permalink 0.0.2

I updated permalink to work with metadate 0.0.3. This lets the absolute plugin look up permalinks outside the current directory.

Download permalink 0.0.2

Documentation is available here.

Metadate 0.0.3

I updated metadate to parse metadates contained in stories. I had to do this because entries_cache wasn’t providing metadates for stories outside the current directory, but the permalink plugin needs those.

Download metadate 0.0.3 Be sure to rename it to “metadate”

Documentation is available here.

Dotcat 0.3

Here is dotcat version 0.3. Changes from the previous version include:

Download dotcat 0.3

marbles 0.6

Just for fun in the evenings, my wife and I have been working on a simple marbles solitaire game. Yeah, we know, there are already hundreds of versions of this game. That isn’t the point. It is a way for us to learn SDL and keep our programming skills sharp. It isn’t finished yet so there are some rough edges, but we are posting it anyway. In the game, just click to move pieces around. ‘q’ quits and ‘r’ resets the board.

Download source code
win32 binaries

Mountain Biking over Oat Hill Mine road

3 weeks ago my wife, brother, and I got the opportunity to mountain bike from Aetna Springs to Calistoga. This ride starts on private property but my parents obtained permission to cross through a friend of the owner.


The route follows an old wagon road which goes over the mountains between Aetna Springs and Calistoga. The road used to be used to reach the numerous mines in the area, and in some parts you can still see the ruts worn into the rock by the wagon wheels. We started a few miles past the old Aetna Springs resort, at a gate where a sign proclaimed “End of county maintained road.” From there the road goes up, skirting along the edge of a hill. The road was fairly rough on the way up and we ended up walking quite a lot of it. My parents, who were hiking, were able to keep up with us on this section of the road. The terrain in this area is very desolate and filled with odd looking volcanic rock outcroppings.

After the first main climb the road crosses a small valley before dropping down to Maple spring. Right before the road starts down there was was a small cave next to the road. The tracks from 4-wheel drive vehicles, which we had seen from the start of the ride, stopped at the cave. After that, the trail was considerably more brushy, and in most areas it was reduced from a road to a single track. In a few places we walked just to avoid touching the poison oak infringing on the trail.

Maple spring didn’t have very much water, but it would have been enough to drink if we had been thirsty (it might have been hard to get to the water through the brush, however). From here the trail climbed up until it met the hiking trails in the Palisades area near Calistoga. There were some great wildflowers along the trail, although often the trail was technical enough that we had to stop riding if we wanted a chance to look at the flowers.


Once we met the Palisades trail, it was all downhill. The first section down is all rocks and was some of the most technical riding I have ever done. I think I walked at least half of it, and almost went over the handlebars twice. I definitely would have felt better with some body armor here. After leaving the technical rocks the trail is much nicer. There were still the occasional rocks in the trail, but after the section at the top we were ready to take them on.


This was a great ride. We probably won’t ever have the opportunity to do it again (owing to the private property at the start) but I’m glad we were able to do it once. It isn’t something I would want to do every day, however. By the time we got down our hands were aching from braking and hanging on over the bumps.

dotcat 0.1

I’ve been working on a utility to combine dot files before they are run through graphviz. My goal is to combine the per-class inheritance diagrams which doxygen generates into a single large diagram that shows inheritance for all the classes in a project (of course, it should be useful for combining other graphs). I don’t have everything just the way I want it, but it is working now so I figured I would post it.

Currently it only combines two dot files at a time. You use it like this:

dotcat in1.dot in2.dot out.dot

In the future I would like to add the ability to combine multiple dot files, along with better control over how they get combined (right now it doesn’t always keep the URL attributes of nodes, for example)

Download dotcat 0.1

Fullcategory 0.0.2

Well, the last version of fullcategory had a bug which broke permalinks. Yes, this plugin was supposed to fix a bug but instead contained a bug…haha. Thanks to Gary Gale for finding the problem. Anyway, here is the new version.

Download fullcategory 0.0.2

Documentation is available here.

Fullcategory

By default, blosxom will return results for partial category name matches. For example, if “telephone” is a category, these would all return posts about telephones:

(If “television” was also a category, that last example would include posts from both the television & telephone categories)

This behavior gets in the way of Fletcher’s emptymessage plugin, so I wrote the fullcatgory plugin. Fullcategory changes Blosxom so only full category names will give results. This lets the emptymessage plugin do its thing. I’m pretty sure that with both emptymessage and fullcategory installed, I will be able to run an automatic link checker over my site and find dead (404) links, where before some links went to empty blosxom pages.

Download fullcategory 0.0.1

Documentation is available here.