views:

34

answers:

1

Hello guys,

I use ID3DXSprite interface to draw gui controls in my app. I have a 512x512 texture with all controls and use sprite->Draw() telling the exact RECT of control. Everything works fine except a strange bug on only one(!) machine.

Normally, the control looks: alt text

And on that strange machine: alt text

Moreover, some controls look fine but also many of them look like this one - with corrupted edges and ... well you can see the difference :(

The second machine has Intel(R) G41 Express Chipset video adapter. Please, if someone has ANY ideas why can it happen - help!

Regards, Anthony.

+1  A: 

It looks to me like you have mipmaps in the sprite's texture and the card is choosing the wrong mipmap level. Set the mip map level, explicitly to 1, and see if that helps.

Goz
Well, thanks a lot for the answer! I'm using D3DXCreateTextureFromFileInMemoryEx function and if I understood correct I have to set the MipFilter properly. But there are a lot of flags - http://msdn.microsoft.com/en-us/library/bb205565(v=VS.85).aspx Can you advise smth?
Dalamber
You don't need a MipFilter if you aren't doing mipping.
Goz
I have the MipLevels variable set to 1 in D3DXCreateTextureFromFileInMemoryEx function but still no effect. BTW I've noticed that indeed it looks like I have problems with drawing only transparent images (with various alpha value). What should be transparent - is black or "noisy"...
Dalamber
Are you using a DXTC texture?
Goz
IDirect3DTexture9. And *.png image in resources.
Dalamber
What D3DFMT do you use?
Goz
Errhm.. D3DFMT_UNKNOWN :)
Dalamber
Hmmm ... thats not the issue then. How do you set the UVs for rendering? Do you add on a half texel offset to the UV coords?
Goz
I use integral numbers for storing the exact RECT on texture (for each button). then i call: pSprite->Begin(D3DXSPRITE_OBJECTSPACE);pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT); after that I call pSprite->Draw method and pass it the entire texture and rect for exact control. THE POINT IS that everything works absolutely great except for one machine (whith that ugly intel video). And that misleads me..
Dalamber
Problem is that intel's drivers are full of bugs. I'm trying to figure out what. I'm not entirely familiar with ID3DXSprite (As I have always chosen to implement my own system). Can i suggest using D3DTEXF_LINEAR instead of POINT and seeing if that makes a difference?
Goz
wow! Yep, that makes a difference! All transparent pixels are displayed correct and beautiful. BUT with _LINEAR flag I get some problems with offsets. Some controls are shifted on a pixel or may be a half.
Dalamber
Can you post up a screenshot after you've made that change? Have you tried updating the intel's drivers btw?
Goz
The drivers are 1/16/2009 and Microsoft Update says they're the latest. Nevertheless, I'm satisfied with the result - thanks for your help! And about a small offset - I dont think it a big problem. Lets just leave it as is :) Thx.
Dalamber
@Dalamber: No probs. Glad I was some help ... even if it took a while ;)
Goz