Texture aliasing in win7

Started by
8 comments, last by Khatharr 11 years, 11 months ago
Hello.

I've created a small project with DX9 on my home machine, which runs WinXP. The game runs fine there and looks decent (well... looks as expected) but when I brought it to my mom (who I designed it for) it runs correctly on her Win7 machine, but there's horrible texture aliasing on everything.

Is there something I should be dong for Win7 compat or does anyone recognize this problem?

Attached are a pair of screenshots. Same build and everything, but one on my WinXP machine and one on my mom's Win7 machine. The difference is quite clear if you look at them full-sized. (They're 800x600.)

Thanks in advance for any advice. smile.png

P.S. - The font looks different because I neglected to bring a copy of the fonts I used from home. It's the rest of it that I'm worried about.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Advertisement
Different graphic cards handle anti-aliasing differently. Are you "Checking The Device Multi Sample Type"? You can poll the hardware to determine what type of anti-aliasing is available and then setting that in your code?

I've been around the world and back over this subject and I've found that using the graphics card's multisampling is the best and simplest solution.

If this application is for your mom only then you might be able to make the anti-aliasing changes in the graphic cards UI (control panel) manually to get by.
It is for my mom, but it's also an educational exercise for me in terms of DX and also just basic design practices.

I don't think I've explicitly enabled any type of AA. Everything in this project is 2D sprites rendered with D3DXSprite, so I didn't figure I'd need any AA. I'll bring the code with me next time I come over here so I can see what I'm doing. In the meantime I'll take a look at the DX docs about AA and see what I can come up with.

Thank you for the advice! :)
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
It looks like the size of your backbuffer doesn't match the size of your window's client area. The size of the client area for a given window size will definitely be different when going from XP to Win7. AdjustWindowRectEx can be used to ensure that you get the client area that you want.

It is for my mom, but it's also an educational exercise for me in terms of DX and also just basic design practices.

I don't think I've explicitly enabled any type of AA. Everything in this project is 2D sprites rendered with D3DXSprite, so I didn't figure I'd need any AA. I'll bring the code with me next time I come over here so I can see what I'm doing. In the meantime I'll take a look at the DX docs about AA and see what I can come up with.

Thank you for the advice! smile.png



If you're only rendering sprites AA shouldn't be an issue. Please disregard my comment. MJP's post makes more sense.
True, if memory serves the backbuffer is 640x480 and the window is sized to 800x600. For some reason it didn't occur to me that that could cause aliasing (I don't think I woke up completely this morning.). I use AdjustWindowRect() already. Would AdjustWindowRectEx() be a better choice for this? I was under the impression that they did more or less the same thing, but I haven't really looked at the extended version.

I guess really I was just suprised that the behavior would be different between the two OSes. It may be a hardware difference, as DJTN stated. I don't really want to install VS on my mom's machine, so I'll have to just dig thorough my DX code and try a few different builds and then bring them back here and see which ones work better. The problem is going to be somewhere in my base-code, which I use for all my DirectX projects, so I'll have to fix it eventually.

Thanks again for the advice. :)
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Use AdjustWindowRectEx if you're creating your window with CreateWindowEx, otherwise plain old AdjustWindowRect is all you need. Just make sure to pass them the same styles (and exstyles) that you're using in your CreateWindow(Ex) call and all will be good.

Generally I'd use AdjustWindowRect(Ex) before the CreateWindow(Ex) call to get the adjusted size (including title bar, borders and other widgets) for use when creating. Just set up a RECT struct containing your backbuffer size for right and bottom (top and left can be 0), call AdjustWindowRect(Ex) using it, then CreateWindow(Ex) using (right - left) for width and (bottom - top) for height, and finally center the window or otherwise move it to it's final position. Another option is to call GetClientRect on your created HWND and use the values from that for your backbuffer size, but of course the backbuffer will be smaller than the actual resolution you want (which may or may not matter to you).


True, if memory serves the backbuffer is 640x480 and the window is sized to 800x600

It's probably better to use a 640x480 render target with a backbuffer the same size as your window for this, then either draw or StretchRect the render target surface to the backbuffer surface. That would give you more control over the filtering used at the cost of some performance, which I guess isn't too critical for the style of program you have.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I think I may have found a solution. The current build uses point filtering for texture sampling, so I rebuilt a pair of exe's with linear and gaussian filtering, but since I'm apparently not too bright I built debug rather than release and the debug build won't run on my mom's machine. I use CreateWindow rather than CreateWindowEx, so I think that part is okay.

On a fun side note I visited my dad's place and tested it on his laptop and apparently I shouldn't assume that texture address mirroring is available. (Dangit...)

Anyway, thank you again for all the advice. I'm hoping to get my core engine tight and adaptable so that future projects will have a reliable base to work from.

Once this project is presentable I'll upload the source and post a link here and maybe ask for advice on the structure and layout of the code, since I'm also concerned that I'm not using optimal design practices (being auto-didactic and all).

Thank you!
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Just an update concerning the original issue. I brought my latest build with me (compiled as release instead of as debug this time) and it uses gaussian texture sampling rather than point, but it still has the same rendering problem. I'm beginning to suspect that this video card is piece of trash and can't handle texture scaling well. I've had graphics issues with professionally made games on this as well, but found ways to resolve those by adjusting the card settings. That's just not working in this case.

Looking in the device manager I see the adapter listed as "Intel® HD Graphics", with no other information provided, so I'm thinking this is a crappy on-board adapter. I think there may be no way to solve this issue without simply disabling the up-scaling. I'm not going to do that in the case of this app, since the scenes and image resources are all designed using 640x480 coords, but in the future I'll just use a larger display area from the beginning.

I'm almost done cleaning the code up. I'll probably post it here in a rar in a week or two. I just refactored a lot of the game logic and it's running a lot nicer now.

Thanks again to everyone who advised.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Ah, well... It's still not complete yet, but I think the structure of the engine is more or less as I've planned for it at this point. The work left is bug-fixing and expanding the content.

Anyway, I'm posting the code now. There's build instructions inside as well in case you want to test the game out. If I could get advice about the structure of the code in terms of whether or not you detect any code smells or screw-ups on my part. I am aware that I mix camel-case and underscore. That's something that I plan to go through later and clean up a bit once I decide on a standard. Also, since I've been spending a lot of time in the code I haven't commented a lot and I really should in some places, but that's another thing I plan to run through and do later.

Other than that any advice about the structure or any mistakes you can see me making that you could warn me about would be awesome.
Again, thanks in advance for your help! smile.png
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement