Fernando J. Pereda’s blag

May 10, 2009

OpenSceneGraph

Filed under: blag — Tags: , , , , — Fernando J. Pereda @ 11:18 pm

For SpaceFish I wanted a quick way to load a 3D model and be able to rotate it easily. This, along with an artificial horizon is a nice way to see the attitude of the plane while it is far to see it. It is also quite good to replay recorded data during experiments to study it further in the lab.

Since I haven’t really done anything in OpenGL beyond stupid examples and helloworld-like programs and given that I don’t have much time to devote to this task I decided to use an existing framework. Among Irrlicht, OpenSceneGraph and Ogre. I decided to give OpenSceneGraph a try, for no particular reason.

Unfortunately, it took a while to get it working under OSX… it needs something like this. I use MacPorts for this kind of stuff under OSX:

fixOpenSceneGraph()
{
	local lib_dir=/opt/local/lib
	pushd ${lib_dir} > /dev/null
	echo pushd ${lib_dir}
	for i in libosg*.dylib* libOpenThreads*.dylib* ; do
		echo install_name_tool -id ${lib_dir}/${i} ${i}
		otool -L ${i} | sed -e 1d | while read f ; do
			if [[ ${f} =~ ^libosg ]] || [[ ${f} =~ ^libOpenThreads ]] ; then
				l=${f%% *}
				echo install_name_tool -change ${l} ${lib_dir}/${l} ${i}
			fi
		done
	done
	popd > /dev/null
	echo popd
	port contents OpenSceneGraph |
		sed -n -e '/^[[:space:]]*\/opt\/local\/bin\//p' -e '/\.so/p' |
		while read f ; do
		otool -L ${f} | sed -e 1d | while read d ; do
			if [[ ${d} =~ ^libosg ]] || [[ ${d} =~ ^libOpenThreads ]] ; then
				l=${d%% *}
				echo install_name_tool -change ${l} ${lib_dir}/${l} ${f}
			fi
		done
	done
}

It wasn’t fun to figure that out (thank you CMake)…

Anyway, I think I’ll stick to OpenSceneGraph until it annoys me enough. For now, I managed to do what I wanted in less than 2 hours, which is pretty good when you have a stupidly tight schedule.

— ferdy

Advertisements

February 10, 2009

Selected!

Filed under: blag — Tags: , , , , — Fernando J. Pereda @ 7:11 pm

So this led to this

’nuff said!

Mood: Extremelly happy.

— ferdy

Blog at WordPress.com.