Strange looking graphic

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Counterfeit
Posts: 9
Joined: Tue Jun 06, 2006 2:37 am
Location: Germany

Strange looking graphic

Post by Counterfeit »

Hi,
I´m working on a litte Game in Irrlicht.NET and for my background I use a selfmade graphic (Good looking). But when I use this in the engine it looks very strange (Strange huh?). It only show the "correct" image with the software renderer and apfelbaum. Have anybody a resolution?

Oh and I add the image with this code:

Code: Select all

IGUIElement background = env.AddImage(driver.GetTexture(mediaPath + "background.jpg"), new Position2D(0, 0), false, null, 0, "");
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

looks like your image is being resized. there is an option to disable this (disable mip-maps before loading, then enable again afterwards i think) but the best option is to make sure your image is a power of two wide and tall, as some graphics cards can't handle oddly shaped textures.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Counterfeit
Posts: 9
Joined: Tue Jun 06, 2006 2:37 am
Location: Germany

Post by Counterfeit »

Hi i disable the mip-maps creation, but it looks like the same. How you mean that "make sure your image is a power of two wide and tall"?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I think I was wrong about the resizing option :oops:
valid powers of 2 for a texture are 16, 32, 64, 128, 256, 512, 1024 and 2048. larger than 2048 or smaller than 16 is asking for trouble
in your case (640x480) rounds up to 1024x512. leave empty space on the right and bottom sides rather than scaling the texture. this may seem like a waste, but your card will scale it to that resolution anyway.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Counterfeit
Posts: 9
Joined: Tue Jun 06, 2006 2:37 am
Location: Germany

Post by Counterfeit »

Hi,
thanks now it works but can´t I simulate the 1024x512 because it looks so daft. I must convert all of my graphics to this format? Thats horrible. Then I work rather with the software renderer it works wonderful too ;)
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

what do you mran? your window size remains at 640x480, its your texture that is 1024 by 512.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Counterfeit
Posts: 9
Joined: Tue Jun 06, 2006 2:37 am
Location: Germany

Post by Counterfeit »

Hi,
yes that is the "problem". I must convert all graphics with the formats you post? I have many little graphics and all graphics I must edit. Or is that wrong?
Braneloc
Posts: 68
Joined: Fri Jan 20, 2006 5:12 am
Location: England
Contact:

Post by Braneloc »

I'll lay odds the scaling size is off by one.

I've seen this effect a hundred times in a dozen engines, and always the same problem. I don't have an easy irrlicht workaround, but if you make your original image either one pixel smaller, or one pixel larger(can't remember which, sry), the scaling error should work in your favour instead of against it.

(As to the power of 2... this is really an issue only with old cards (pre-geforce).. some card internals can still do the internal rescale, but you won't notice this on a modern card or a recent directX. Rescaling your image to a power of 2 may be considered "good" practice, but is unlikely to solve your problem and will likely cause more trouble than it's worth)
Sometimes you've just gotta say, the laws of time and space, who gives a smeg ?!

Irrlicht.Net Information - http://www.irrforge.org/index.php/.net
Irrlicht# (aka the C# port) - http://irrlichtsharp.sourceforge.net
Locked