Page 1 of 1

Simply 2D-Animation

Posted: Wed Aug 27, 2003 3:31 pm
by Jailbird
hey

the following code should draw a simply 2D-texture, but all I see is a white windows and nothing else...what's wrong? (file exists!!)

Code: Select all

int main()
{
// set up engine
	IrrlichtDevice *device = createDevice(video::DT_OPENGL, core::dimension2d<s32>(640, 480), 16, false, false, 0);
	device->setWindowCaption(L"2D Tests");

	video::IVideoDriver* driver = device->getVideoDriver();
	video::ITexture* images = driver->getTexture("tooldesign.jpg");

// now draw the whole scene
	while(device->run() && driver)
	{
		if (device->isWindowActive())
		{
			driver->beginScene(true, true, video::SColor(0,0,0,0));
			driver->draw2DImage(images, core::position2d<s32>(0,0), core::rect<s32>(0,0,640,480));
			driver->endScene();
		}
	}
	device->drop();
	return 0;
}
i also tried to let core::rect<s32>(0,0,640,480) away, but without success :(

Posted: Wed Aug 27, 2003 3:45 pm
by knightoflight
maybe your texturefile is not in the path ? Try it with the full path, for example "c:/pictures/texture.bmp"

Posted: Wed Aug 27, 2003 6:35 pm
by Guest
Make sure that your .jpg is in the same project dir you're compiling from. If that doesn't work then get rid of some of your extra logic in the while loop. Change while(device->run() && driver) to just while(device->run()) and get rid of that if (device->isWindowActive()){} and see if it works then.

Posted: Thu Aug 28, 2003 7:55 am
by Jailbird
i'll tried, but it doesn't work. the picture exists and can be viewed in any other graphic program (even ms paint). i modified also the drawing-line to see what happens

Code: Select all

driver->draw2DImage(images, core::position2d<s32>(100,100));
now, the white rectancgle (and it shouldn't be white) is positioned at 100,100.

ooooooouuuuuuuuuuu yeah...i changed my renderer from DT_OPENGL to DT_SOFTWARE as a test and this one is able to load and show the picture correctly...why this?

Posted: Thu Aug 28, 2003 8:25 am
by niko
This is strange. I was able to reproduce an error like this in my version here. I'll try to find and fix the bug until next week.

Posted: Thu Aug 28, 2003 8:52 am
by Raumkraut
Could it be a problem with your installed OpenGL drivers?
Does it work with other graphic file formats?

Posted: Thu Aug 28, 2003 8:56 am
by Jailbird
i tested *.bmp, *.jpg and *.tga :) no one worked, but with the software renderer, the pictures are displayed correctly...really strange, but "luckely" :?: irrlicht could reproduce this error

Posted: Thu Aug 28, 2003 8:57 am
by niko
Could be, but I don't think so. You could try out with .bmp, but I think the problem is somewhere inside Irrlichts OpenGL device. But if it works with .bmp or another driver, I would be happier. :)