The result is that the full screen quad moves around on screen as if it were part of the 3d scene.
Code: Select all
#include <string.h> // for strcmp
#include <irrlicht.h>
using namespace irr;
#ifdef _IRR_WINDOWS_
# pragma comment(lib, "Irrlicht.lib")
#endif
int main(int argc, char* argv[])
{
video::E_DRIVER_TYPE driverType = video::EDT_BURNINGSVIDEO;
for (int i = 1; i < argc; ++i)
{
if (!strcmp (argv[i], "-opengl"))
driverType = video::EDT_OPENGL;
else if (!strcmp (argv[i], "-d3d8"))
driverType = video::EDT_DIRECT3D8;
else if (!strcmp (argv[i], "-d3d9"))
driverType = video::EDT_DIRECT3D9;
else if (!strcmp (argv[i], "-software"))
driverType = video::EDT_SOFTWARE;
else if (!strcmp (argv[i], "-burning"))
driverType = video::EDT_BURNINGSVIDEO;
else {
return -1;
}
}
IrrlichtDevice *device = createDevice(driverType, core::dimension2d<s32>(640, 480), 16);
if (!device)
return 1;
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNodeFPS();
scene::SMeshBuffer mb;
mb.Indices.set_used (6);
mb.Indices[0] = 0;
mb.Indices[1] = 1;
mb.Indices[2] = 2;
mb.Indices[3] = 0;
mb.Indices[4] = 2;
mb.Indices[5] = 3;
const video::SColor white(255, 255, 255, 255);
mb.Vertices.set_used (4);
mb.Vertices[0].Pos.set (-1.f, -1.f, 1.f);
mb.Vertices[0].TCoords.set(1.0f, 1.0f);
mb.Vertices[0].Color = white;
mb.Vertices[1].Pos.set (-1.f, 1.f, 1.f);
mb.Vertices[1].TCoords.set(1.0f, 0.0f);
mb.Vertices[1].Color = white;
mb.Vertices[2].Pos.set (1.f, 1.f, 1.f);
mb.Vertices[2].TCoords.set(0.0f, 0.0f);
mb.Vertices[2].Color = white;
mb.Vertices[3].Pos.set (1.f, -1.f, 1.f);
mb.Vertices[3].TCoords.set(0.0f, 1.0f);
mb.Vertices[3].Color = white;
const core::matrix4 identity;
video::SMaterial material;
material.setTexture(0, driver->getTexture("../../media/010shot.jpg"));
material.Lighting = false;
while(device->run())
{
if (driver->beginScene(true, true, video::SColor(0,200,200,200)))
{
smgr->drawAll();
driver->setTransform(video::ETS_WORLD, identity);
driver->setTransform(video::ETS_VIEW, identity);
driver->setTransform(video::ETS_PROJECTION, identity);
driver->setMaterial(material);
driver->drawMeshBuffer(&mb);
driver->endScene();
}
}
device->drop();
return 0;
}