Interesting, it only occupies 3% of the GPU in each frame if I limit it to 25 FPS, without the limit 65%, while the visual studio versions occupies 100% of the gpu in each frame(Although I have not seen it limited to 25 FPS). In fact the software renderer version occupies 0% of the CPU(25 FPS), that is to say that the consumption is extremely low(although this is due to the 640x480 resolution, in 800x600 it occupies 10%).
Code: Select all
#include <irrlicht.h>
#include <windows.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
/*
EDT_NULL, EDT_DIRECT3D8 , EDT_DIRECT3D9, or EDT_OPENGL.
*/
IrrlichtDevice *device =
createDevice(EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<int>(10,10,200,22), true);
IAnimatedMesh* mesh = smgr->getMesh("../../Examples/irrlicht/media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("../../Examples/irrlicht/media/sydney.bmp") );
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
Sleep(40);//1000:40=25
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Modern versions usually have a high performance by taking full advantage of the capacity of the graphics card, in my case I prefer a high performance but without spending too many resources.
I wonder if there is any way to bring the new versions of irrlicht to devc++....