Page 1 of 1

loading a 2d image ...

Posted: Sun Jul 03, 2005 2:47 pm
by Picard
hey guys,
sorry for this question, but I have a huge problem with loading 2d images (for example as a "please-wait-while-loading screen")...

I load that image (tga file) from a zip file (of course uncompressed) ...

Code: Select all

device = createDevice(x, dimension2d<s32>(screenw, screenh), bpp, false, false, false, 0);

[...]

ITexture *splash;
splash = driver->getTexture("images/logo.tga");

while(device->run() && driver)
    {
		driver->beginScene(true, true,0);
		
		// show the splash screen
		if(State == SPLASH && bSO==true)
		{
			bSO=false;
			guienv->addImage(splash, core::position2d<s32>(0,0));
		}

		smgr->drawAll();
		guienv->drawAll();
		
        driver->endScene();
    }
well, the image is loaded and displayed, but it looks very strange...
(I´ve uploaded as jpg because the files are very big)

Original: http://img56.imageshack.us/img56/3355/logo3ji.jpg
My App: http://img56.imageshack.us/img56/6500/screen6go.jpg

as you can see, my app displays it, but in a lower quality.... what´s the reason? :(
I`ve already tried to store that image as bmp... but without any effect 8[

Posted: Sun Jul 03, 2005 6:43 pm
by Armen138
make sure your image is a power of 2 size.. you could also try splitting it up into smaller images, not sure if that helps

Posted: Sun Jul 03, 2005 7:15 pm
by Picard
I also tried to load that small Irrlicht logo (irrlichtlogo.bmp) from the media directory, but it´s displayed in the same way. :(

EDIT:
k, you were right :)
when I tried to load "irrlichtlogoaligned.jpg", it was displayed in the correct way :)

but does maybe anybody know if there´s a way to load 800x600 images with the engine? ^^
thanks in advance :)

Posted: Mon Jul 04, 2005 6:26 am
by Suliman
You probably have to add empty space around the pic, making it 1024x1024 and then draw the 800x600 area as a part of the whole pic (see 2d tutorial).

Hope that helps.
Suliman

Posted: Mon Jul 04, 2005 12:12 pm
by Picard
lol yeah, that`s a simple solution ... shame over me!

but really thanks to you ^^