Graphics on Irrlicht

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
shivanraptor
Posts: 40
Joined: Tue Aug 15, 2006 6:01 am
Location: Hong Kong
Contact:

Graphics on Irrlicht

Post by shivanraptor »

My graphics in Irrlicht looks strange .
Image

but the original image looks like this :
http://www.hkrcg.com/skybox/gauge_model1.bmp

The pic uses Adobe Illustrator CS to make it .
using CMYK mode .
I then copy it to Adobe Photoshop CS for further tunings.
I first change to RGB mode .
Add a layer .
Arrange the new layer to the bottom , fill it with color RED ( 255, 0,0 ) #FF0000 .
Then save as 24-bit bitmap in Windows format .
I guess it is about anti-aliasing problem .

My code is as follow :

Code: Select all

 
            string meter_panel_path = Application.StartupPath + "\\..\\..\\res\\gauge_model1.bmp";
            DriverType dt = DriverType.DIRECT3D9;
            IrrlichtDevice device = new IrrlichtDevice(dt , new Dimension2D(800, 600), 32, false, true, true);
            if (device == null)
                return;
            IVideoDriver driver = device.VideoDriver;
            ITexture meter_panel = driver.GetTexture(meter_panel_path);
            driver.MakeColorKeyTexture(meter_panel, new Position2D(5, 5));
            while (device.Run() && driver != null)
            {
                if (device.WindowActive)
                {
                    driver.BeginScene(true, true, new Irrlicht.Video.Color(0, 0, 0, 0));
                    driver.Draw2DImage(meter_panel, new Position2D(100, 20));
                    driver.EndScene();
                }
            }
            System.GC.Collect();
Please advice .
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

Change the image size to a factor of 2 - such as 32x32, 64x64, 128x128, 256x256, 512x512, etc. That will fix the odd distoration of the image.
shivanraptor
Posts: 40
Joined: Tue Aug 15, 2006 6:01 am
Location: Hong Kong
Contact:

Post by shivanraptor »

yes , it solved the problem .
thanks for help
Nae'blis
Posts: 2
Joined: Sat Aug 12, 2006 3:37 pm
Location: Dundee, UK
Contact:

Post by Nae'blis »

I also found that when doing 2D work changing the renderer to be system default 1 or 2 fixed similar issues. Using DX or GL would 'corrupt' the image too badly for text to be read.
Designed with ObSkewer thinking...
RhavoX
Posts: 33
Joined: Tue Jul 04, 2006 7:27 pm

Post by RhavoX »

This is not Irrlicht's fault. Graphic cards are distorting every image that has no power of 2 size :)
Teh Uber-Pwner xD
IPv6
Posts: 188
Joined: Tue Aug 08, 2006 11:58 am

Post by IPv6 »

you can also split image to square pieces (especially if this is a big image, bigger that 512*512) at run time to avoid image distortion. each piece will be in separate texture.
check this for details (irr1.1): http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15029
here is the example with source http://www.upload2.net/page/download/r7 ... e.zip.html
Post Reply