If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
xteraco
Posts: 12 Joined: Fri Sep 15, 2006 11:42 pm
Post
by xteraco » Thu Jun 28, 2007 3:26 am
I got some code I've done up. It seems like it should work, but I'm getting runtime error. The error being, no image is displayed.
Here is the code.
Code: Select all
#include <irrlicht.h>
#include <iostream.h>
using namespace irr;
using namespace video;
using namespace scene;
using namespace core;
using namespace gui;
int main(int argc, char * argv[]){
ISceneNode * xNode = 0;
IrrlichtDevice * xDevice = createDevice(EDT_OPENGL, dimension2d<s32>(640,480),32,false);
IVideoDriver * xDriver = xDevice->getVideoDriver();
ISceneManager * xSmgr = xDevice->getSceneManager();
xNode = xSmgr->addCubeSceneNode();
xNode->setPosition(core::vector3df(0,0,30));
xNode->setMaterialTexture(0, xDriver->getTexture("loading.jpg"));
while(xDevice->run()){
xDriver->beginScene(true,true,SColor(0,0,0,0));
xSmgr->drawAll();
xDriver->endScene();
}
xDevice->drop();
return 0;
}
raven_coda
Posts: 89 Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:
Post
by raven_coda » Thu Jun 28, 2007 3:36 am
You gotta have a camera to veiw it all from;
try adding this
Code: Select all
scene::ICameraSceneNode* cam=xSmgr()->addCameraSceneNodeFPS();
before your while loop
Definition of an Upgrade: Take old bugs out, put new ones in.
xteraco
Posts: 12 Joined: Fri Sep 15, 2006 11:42 pm
Post
by xteraco » Thu Jun 28, 2007 3:47 am
Ah, wow, cant believe I missed that... Gotta shed some light on the situation to..
Code: Select all
xNode->setMaterialFlag(EMF_LIGHTING,false);
xteraco
Posts: 12 Joined: Fri Sep 15, 2006 11:42 pm
Post
by xteraco » Thu Jun 28, 2007 3:05 pm
What if I wanted to take this code, and display the image as a 2d image? How would I need to adjust it... I've tried a few things, and not been able to achieve success. The way I'm trying to do this is, modify the code I have in this post, if that helps any.
xteraco
Posts: 12 Joined: Fri Sep 15, 2006 11:42 pm
Post
by xteraco » Thu Jun 28, 2007 6:49 pm
Got this one figured out.. Thanks.