total n00b question

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.
Post Reply
Total n00b

total n00b question

Post by Total n00b »

Hi,

I'm trying to make a simple game, and I'm starting out with simple things and building up as I get stuff to work. First on the list is a skybox. Here is my code:

Code: Select all

#include <irrlicht.h>
#include <wchar.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")

ICameraSceneNode* camera = 0;

class MyEventReceiver : public IEventReceiver{
public:
	virtual bool OnEvent(SEvent event) {
		if (camera)
			return camera->OnEvent(event);

    return false;
	}//end method
};//end class


long WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
	MyEventReceiver receiver;

	IrrlichtDevice *device = createDevice(DT_OPENGL, dimension2d<s32>(800,600), 16, false, true, &receiver);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	ISceneNode* node = 0;

	node = smgr->addSkyBoxSceneNode(
		driver->getTexture("../media/up.bmp"),
		driver->getTexture("../media/down.bmp"),
		driver->getTexture("../media/left.bmp"),
		driver->getTexture("../media/right.bmp"),
		driver->getTexture("../media/front.bmp"),
		driver->getTexture("../media/back.bmp"));

	device->getCursorControl()->setVisible(false);

	camera = smgr->addCameraSceneNodeFPS();
	camera->setPosition(core::vector3df(-50,50,-150));

	int lastFPS = -1;

	while(device->run()) {
		driver->beginScene(true,true,SColor(0,100,100,100));
		smgr->drawAll();
		guienv->drawAll();
		driver->endScene();

		int fps = driver->getFPS();
		if(lastFPS != fps) {
			wchar_t tmp[1024];
			swprintf(tmp, 1024,
				L"Stuff... (fps:%d) Triangles:%d",
				fps, driver->getPrimitiveCountDrawn());

			device->setWindowCaption(tmp);
			lastFPS = fps;
		}//end if
	}//end while

	device->drop();
	return 0;

}//end main
I know that I am getting files that are where they say they are. All I get is a grey window, and no skybox. Please help!

Thanx,
Me.[/code]
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Does the skybox work for you in the examples?
n00b

Post by n00b »

yeah they do. That's what's bothering me, because (as best as I can see) I'm using code almost coppied and pasted from the examples...
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Your code looks right. See the paths to the skybox pics though

Code: Select all

driver->getTexture("../media/up.bmp");
are those the same paths to the pics that you are using for your skybox? Maybe it's not finding the pics, try putting them in the same directory you are compiling from and just use

Code: Select all

driver->getTexture("MYPICTURENAME.jpg");
total n00b

Post by total n00b »

Okay, I got it. I was running the exe from inside ms vc++, so the paths were from temp paths, not from the actual file... It works now.
Post Reply