UbuntuでIrrlicht

ここを参考にUbuntu12.04でIrrlichtでhello, world。
まずここからirrlicht-1.8.zipをダウンロードして展開(今回は~/irrlicht-1.8/に展開)。

ビルドの準備。

$ sudo apt-get update;sudo apt-get install build-essential libglu1-mesa-dev libxxf86vm-dev

ビルド。

$ cd ~/irrlicht-1.8/source/Irrlicht
$ make

特に問題なくビルドまで終了。

とりあえずhello, world。
[~/main.cpp]

#include 
int main()
{
irr::IrrlichtDevice *device = irr::createDevice( irr::video::EDT_SOFTWARE, irr::core::dimension2d(640, 480), 16, false, false, false, 0);
device->setWindowCaption(L"hello, world");
irr::gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"hello, world",irr::core::rect(10,10,260,22), true);
irr::video::IVideoDriver* driver = device->getVideoDriver();
while(device->run())
{
driver->beginScene(true, true, irr::video::SColor(255,100,101,140));
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}

ビルドして実行。

$ cd~
$ g++ main.cpp ./irrlicht-1.8/lib/Linux/libIrrlicht.a -lGL -I./irrlicht-1.8/include/ -o hello
$ ./hello

ウインドウが出て「hello, world」が表示されたのでとりあえずよしとする。