Irrlicht引擎使用1

Ex:

#include <irrlicht.h>

using namespace irr;
using namespace irr::core;
using namespace irr::video;
using namespace irr::scene;

int main()
{
   //获取设备对象
  IrrlichtDevice *device = createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16, false, false, false, 0);
   if(!device)
     return 1;

  device->setWindowCaption(L "Hello World!"); //设置窗体标题

  IVideoDriver *driver=device->getVideoDriver(); //与纹理有关
  ISceneManager *smgr=device->getSceneManager(); //获取场景管理器对象

  ISceneNode *cubeNode=smgr->addCubeSceneNode(100.0f); //添加立方体
  ITexture *tex=driver->getTexture( "texture.jpg"); //获取贴图纹理
  cubeNode->setMaterialTexture(0,tex); //为立方体设置贴图纹理
  cubeNode->setMaterialFlag(EMF_LIGHTING, false); //设置贴图与光源无关
   //cubeNode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);//设置半透明Alpha通道

  ICameraSceneNode *camera=smgr->addCameraSceneNode(0,vector3df(200,200,-200),vector3df(0,0,0));

   //游戏循环Game Loop
   while(device->run())
  {
    driver->beginScene( true, true,SColor(255,0,0,0)); //[[Begin

    smgr->drawAll(); //全部绘制

    driver->endScene(); //End]]
  }

  device->drop(); //删除设备对象
   return 0;
}


引擎下载地址:
http://irrlicht.sourceforge.net/downloads.html

贴图:

上图:

你可能感兴趣的:(职场,引擎,休闲,Irrlicht)