Ex:

InBlock.gif#include <irrlicht.h>
InBlock.gif
using namespace irr;
InBlock.gif using namespace irr::core;
InBlock.gif using namespace irr::video;
InBlock.gif using namespace irr::scene;
InBlock.gif
int main()
InBlock.gif{
InBlock.gif   //获取设备对象
InBlock.gif  IrrlichtDevice *device = createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16, false, false, false, 0);
InBlock.gif   if(!device)
InBlock.gif     return 1;
InBlock.gif
  device->setWindowCaption(L "Hello World!"); //设置窗体标题
InBlock.gif
  IVideoDriver *driver=device->getVideoDriver(); //与纹理有关
InBlock.gif  ISceneManager *smgr=device->getSceneManager(); //获取场景管理器对象
InBlock.gif
  ISceneNode *cubeNode=smgr->addCubeSceneNode(100.0f); //添加立方体
InBlock.gif  ITexture *tex=driver->getTexture( "texture.jpg"); //获取贴图纹理
InBlock.gif  cubeNode->setMaterialTexture(0,tex); //为立方体设置贴图纹理
InBlock.gif  cubeNode->setMaterialFlag(EMF_LIGHTING, false); //设置贴图与光源无关
InBlock.gif   //cubeNode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);//设置半透明Alpha通道
InBlock.gif
  ICameraSceneNode *camera=smgr->addCameraSceneNode(0,vector3df(200,200,-200),vector3df(0,0,0));
InBlock.gif
   //游戏循环Game Loop
InBlock.gif   while(device->run())
InBlock.gif  {
InBlock.gif    driver->beginScene( true, true,SColor(255,0,0,0)); //[[Begin
InBlock.gif
    smgr->drawAll(); //全部绘制
InBlock.gif
    driver->endScene(); //End]]
InBlock.gif  }
InBlock.gif
  device->drop(); //删除设备对象
InBlock.gif   return 0;
InBlock.gif}


引擎下载地址:

贴图:

上图: