Code: Select all
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Create the main window
QMainWindow *mainWindow = new QMainWindow();
// Create the central widget to be put into the main window
QWidget *centralWidget = new QWidget(mainWindow);
centralWidget->setAttribute(Qt::WA_PaintOnScreen, true);
mainWindow->setCentralWidget(centralWidget);
// Resize and then show the main window
mainWindow->resize(800,600);
mainWindow->show();
// Create the Irrlicht device
SIrrlichtCreationParameters params;
params.DriverType = video::EDT_OPENGL;
params.WindowId = (void *)(QWidget *)centralWidget->winId();
params.WindowSize.Width = centralWidget->width();
params.WindowSize.Height = centralWidget->height();
params.EventReceiver = 0;
params.AntiAlias = true;
IrrlichtDevice *device = createDeviceEx( params );
ISceneManager *scene = device->getSceneManager();
IVideoDriver *driver = device->getVideoDriver();
IAnimatedMesh *cubeMesh = scene->getMesh("Shirt_test.obj");
IAnimatedMeshSceneNode *cubeNode = scene->addAnimatedMeshSceneNode(cubeMesh, 0, -1, vector3df(0, 0, 0), vector3df(0,0,0), vector3df(10,10,10), false);
cubeNode->setMaterialFlag(video::EMF_LIGHTING, false);
cubeNode->setMaterialTexture(0, driver->getTexture("Billabong_guys_shirt3.bmp"));
ICameraSceneNode *camera = scene->addCameraSceneNode(0);
camera->setPosition(vector3df(0,0,-800));
camera->setTarget(vector3df(0, 0, 0));
device->getTimer()->tick();
driver->beginScene(true, true, SColor(255,100,101,140));
scene->drawAll();
driver->endScene();
return a.exec();
}
Code: Select all
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}