I have tried that but it doesn't do anything.
Here is my project so far:
Code: Select all
#include "irrlicht.h"
#include <math.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
int main()
{
SIrrlichtCreationParameters deviceParameter;
deviceParameter.DriverType = EDT_OPENGL;
deviceParameter.AntiAlias = 4;
deviceParameter.Bits = 32;
deviceParameter.Fullscreen = false;
deviceParameter.Vsync = false;
deviceParameter.WindowSize = dimension2d<s32>(800, 600);
IrrlichtDevice *device = createDeviceEx(deviceParameter);
ISceneManager* smgr = device->getSceneManager();
IVideoDriver* driver = device->getVideoDriver();
ICameraSceneNode * camera = smgr->addCameraSceneNode();
matrix4 ortho;
ortho.buildProjectionMatrixOrthoLH(800, 600, -1, 500);
camera->setProjectionMatrix(ortho, true);
camera->setPosition(vector3df(0, 0, 0));
camera->setTarget(vector3df(0, 0, 1));
camera->setRotation(vector3df(0, 0, 45));
camera->updateAbsolutePosition();
video::S3DVertex Vertices[4];
Vertices[0] = video::S3DVertex(-25,25,0, 0,0,1, video::SColor(255,255,0,0), 0, 0);
Vertices[1] = video::S3DVertex(25,25,0, 0,1,1, video::SColor(255,0,255,0), 1, 0);
Vertices[2] = video::S3DVertex(25,-25,0, 1,0,0, video::SColor(255,0,0,255), 1, 1);
Vertices[3] = video::S3DVertex(-25,-25,0, 0,0,1, video::SColor(255,255,255,255),0, 1);
u16 indices[] = {0,1,2, 2,3,0};
SMaterial myMaterial;
myMaterial.Lighting = false;
SMeshBuffer *buffer = new SMeshBuffer();
buffer->append(Vertices, 4, indices, 6);
SMesh *cubeMesh = new SMesh();
cubeMesh->addMeshBuffer(buffer);
ISceneNode *cubeSceneNode = smgr->addMeshSceneNode(cubeMesh);
cubeSceneNode->getMaterial(0) = myMaterial;
while (device->run())
{
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();
}
}
This doesn't change anything:
Code: Select all
camera->setRotation(vector3df(0, 0, 45));
The square should appear rotated by 45 degrees, but it doesn't. I bet the solution is something extremely simple but I just can't figure it out. I'm using Irrlicht 1.7.1, by the way.