Page 1 of 2

Drawn 2D images are messed up on some computers (most)

Posted: Sun Aug 09, 2009 9:59 pm
by Skomakarn
Hello.

When I try to draw 2D images, it works great on my computer, and looks just like it should, but on most of the computers owned by people who try to run my programs, the 2D images (ITextures, using IVideoDriver::draw2DImage()), the textures appear duplicated, moved, scaled and the entire thing they see on the screen just turns into a mess.

I always use the OpenGL renderer for my programs, but this error shows up on these computers if I try using another one as well.

Here is an example, of what an old menu I made should look like (and looks like, on my computer):

Image

This is what it looks like for most of the people who try to run it, while only a few get a flawless render:

Image

Am I missing something? Am I supposed to implement some kind of double buffer to avoid this? Why doesn't this happen at all computers (more importantly, why does it happen at all, and how do I fix it?)?

I can't make a commercial game if this is what people will get.

Posted: Sun Aug 09, 2009 10:06 pm
by CuteAlien
Are your texture non-power-of-two? In that case it depends if the cards to support that - and many cards don't. To test if that's the reason just use some textures with sizes like 256, 512, 1024 and check if is fine then on other computers.

Posted: Sun Aug 09, 2009 11:57 pm
by Skomakarn
CuteAlien wrote:Are your texture non-power-of-two? In that case it depends if the cards to support that - and many cards don't. To test if that's the reason just use some textures with sizes like 256, 512, 1024 and check if is fine then on other computers.
Yes, they are. I know that might cause problems when using them on meshes, but should it really be a problem when trying to draw them in 2D space?

Posted: Mon Aug 10, 2009 12:48 am
by CuteAlien
Yes it's unfortunately also a problem for the 2D-GUI. Maybe we have a solution some day, but for now it might help to disable NPOT-support on your card for testing. I think you can all driver->disableFeature(EVDF_TEXTURE_NPOT, true) to do that.

Posted: Mon Aug 10, 2009 5:25 am
by Skomakarn
So, you're saying using GUI images instead wouldn't make a difference, either?

Is it notably slow disabling such a feature, or could I use it at least once every frame, to enable for the 3D, and then disable for the 2D (if disabling it means any difference to the 3D, of course; exactly what is NPOT-support?), without any loss of performance?

Posted: Mon Aug 10, 2009 7:16 am
by hybrid
Whyt kind of gfx card do you have? Did you install the latest drivers? IIRC, ATI has major problems with NPOT features, so we might add a work-around if that's the case. We need a proper test for this, though, so maybe you don't want to install latest drivers and lend us a hand while testing the work-around.

Posted: Mon Aug 10, 2009 8:49 am
by Skomakarn
hybrid wrote:Whyt kind of gfx card do you have? Did you install the latest drivers? IIRC, ATI has major problems with NPOT features, so we might add a work-around if that's the case. We need a proper test for this, though, so maybe you don't want to install latest drivers and lend us a hand while testing the work-around.
NVIDIA Quadro FX 570M, but, like I said, it works fine for me. It's not on my computer the problem appears.

If you fix a work-around before this friday noon, though, I could try it out on my girlfriend's computer. I think she had the problem on the one I have access to at the moment.

Otherwise, if we're "lucky", the problem might also appear on my older, stationary computer at home.

Posted: Mon Aug 10, 2009 9:40 am
by hybrid
Well, the work-around would be to disable NPOT for some card lines - so we'd need to know which hw driver and card type this happens on.

Posted: Mon Aug 10, 2009 10:25 am
by Skomakarn
hybrid wrote:Well, the work-around would be to disable NPOT for some card lines - so we'd need to know which hw driver and card type this happens on.
I'll boot her computer up right away, and see if it happens on this one. If it does, I'll tell you about the card it has.

Still I'm wondering, though, if disabling NPOT causes any difference to the 3D rendering, and exactly what is.

EDIT: Yeah, the bug appears, and the card is RADEON 9700 PRO (and she has a secondary one of the same model).

EDIT 2: Disabling NPOT makes no difference on her computer.

Posted: Mon Aug 10, 2009 1:37 pm
by hybrid
Oh wait, there are parts in the images which are not shown at all on the first screenshot. Please show the code for the menu rendering. How many images do you overlap here, do you use alpha blending or something? Maybe it's just some zbuffer problem?
The pixelation seems to be a NPOT problem, but this might be solved with some filtering already.

Posted: Mon Aug 10, 2009 4:03 pm
by CuteAlien
NPOT stands for non-power-of-two. Cards that support that should be able to work also with textures in such resolutions. So my idea was that by disabling this feature on your card, you might see the same problems on your own system which might help in solving them as you wouldn't have to copy the application to other computers to find out how it looks. But I'm exactly sure if that works... you have to try.

Posted: Tue Aug 11, 2009 2:41 am
by BlindSide
I always use the OpenGL renderer for my programs, but this error shows up on these computers if I try using another one as well.
Does this include Burning's Video Renderer?

If you run this demo on the computer experiencing problems do you also get screwed up images? http://www.wc3jass.com/files/Klagui.zip

Ultimately what will help us solve this is if you write a small test case that draws an image or too and shows this problem.

For the devs, theres a mention of the 9700 Pro on this page regarding NPOT textures. It seems we have to use an alternate extension and a different coordnate system? (0 - width instead of 0 - 1)

http://www.opengl.org/wiki/NPOT_Textures

Posted: Tue Aug 11, 2009 7:13 am
by hybrid
Hey, interesting page. That's EXT_texture_rectangle, an extension which is only half the way to real NPOT, and also with these issues of the different coordinate system. It also has the problem that you can only clamp this texture, i.e. no texture repeat. This can, as the text suggest, also emulated by padding of the texture. We could support this if we know that a texture is only used that way. This would require another texture creation flag and some extension handling. Since this might be quite useful for full-screen images and Direct3D also has this feature, we should consider this add-on for 1.7 maybe.

Posted: Wed Aug 12, 2009 7:04 am
by Skomakarn
The table, cup, pen and notebook all are one image, the size of the window.
Then every item in the menu is one menu, but only half the image is drawn, using clipping. One half of the image is the unhovered button, and one part is the hovered one. Then the pencil cursor is semitransparent, with antialias, and the drop shadow.

Posted: Sat Aug 22, 2009 6:56 pm
by Skomakarn
Would I get this problem if I use a POT texture, but try to draw an NPOT part of it, using a clipping rectangle in draw2DImage?