D3D9 - Ortho matrix, RHW co-ords, but my surface is still stretching.

Started by
1 comment, last by Defend 19 years, 10 months ago
I'm using Direct3D9 to display tiles of 128x128 pixels. I create a quad out of 4 vertices using this format: (D3DFVF_XYZRHW|D3DFVF_TEX1) I set the co-ords of the 4 vertices as going from (-0.05f, -0.05f) [top left] to (127.5f, 127.5f) [bottom right]. When it displays the image, the texture is slightly fuzzy, because it has been drawn onto a 128x132 quad. Horizontally its perfect, zoom in and every pixel is cut and dry, this is what I want. However, vertically you can see the filtering. Its not only that the quad has stretched 4 pixels downwards, but also the very bottom row of pixels are a blend of the background (very dark blue) and the 131st row of pixels. I'm sure that's a clue but don't know what to make of it. Here's the image if you want to examine it. I left some surrounding display so you can see what's happening. http://users.wiredcity.net.au/~talez/fuzzed.png Any ideas? [edited by - Defend on June 11, 2004 2:10:28 AM]
Advertisement
The link doesn''t work(at least for me).

Question to you... What function did you use to "load" the image?

When you loaded it did you specify the size of the texture etc or did you just use the LoadFromFile with the filename, device etc.

Just wondering if you loaded it in a way that it is using default filters(which you need to turn off I believe to help in some cases).

I had a similar problem, which I never totally fixed that i know of, because I stopped trying for now :-)

Also... what texture coordinates do you have set? What function did you do to set the texel to the coordinate?

Found the problem just as you replied.

Halfway through developing this I felt like screwing with my Windows settings a bit.. ie, I made my title bars smaller by 5 pixels.

The window I''ve been testing in is resizable, which has been working fine. I''d set its initial size by doing 320x240 + (width and height of frame), which I simply left as values. I remember noticing that and thinking I''ll deal with it later heh.

So the window was created with a client area slightly taller than 320x240, so the image was simply stretched a bit due to the window being resizable. DOH!!

I think I''ll go get the window attributes now heh.

This topic is closed to new replies.

Advertisement