Simply 2D-Animation

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
Jailbird
Posts: 5
Joined: Wed Aug 27, 2003 12:53 pm
Location: Wil, Switzerland
Contact:

Simply 2D-Animation

Post 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 :(
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

maybe your texturefile is not in the path ? Try it with the full path, for example "c:/pictures/texture.bmp"
Guest

Post 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.
Jailbird
Posts: 5
Joined: Wed Aug 27, 2003 12:53 pm
Location: Wil, Switzerland
Contact:

Post 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?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post 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.
Raumkraut
Posts: 31
Joined: Fri Aug 22, 2003 9:41 am
Location: The North, UK

Post by Raumkraut »

Could it be a problem with your installed OpenGL drivers?
Does it work with other graphic file formats?
Jailbird
Posts: 5
Joined: Wed Aug 27, 2003 12:53 pm
Location: Wil, Switzerland
Contact:

Post 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
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post 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. :)
Post Reply