D3D9 2D Windows 7 issue

Place to talk about all that new hardware and decaying software you have.

Moderator: General Mods

Post Reply
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

D3D9 2D Windows 7 issue

Post by mudlord »

http://stashbox.org/957161/Untitled.jpg

http://stashbox.org/957223/Untitled.png : A image with the problem more noticable.
D3D9 co-ordinates are out of whack. On XP its perfect. Not sure what the issue is.

The relevant code is:

Code: Select all

typedef struct
{
	FLOAT x, y, z;
	D3DCOLOR diffuse;
	FLOAT u,v;
} VERTEX;

#define VertexFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)

static VERTEX srcvtx[4]=
{
	{-1.0f, 1.0f,1.0f, 0xffff0000, 0 ,0},
	{ 1.0f, 1.0f,1.0f, 0xffff00ff, 0 ,0},
	{ 1.0f,-1.0f,1.0f, 0xffffff00, 0 ,0},
	{-1.0f,-1.0f,1.0f, 0xff00ff00, 0 ,0},
};
and in the renderer setup, it is:

Code: Select all

	srcvtx[1].u = width / (float)texwidth;
	srcvtx[2].u = width / (float)texwidth;
	srcvtx[2].v = height / (float)texheight;
	srcvtx[3].v = height / (float)texheight;
In the blitter function, I use DrawPrimativeUP with a triangle fan via:
hr = d3ddev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, srcvtx, sizeof(VERTEX));

So I am quite stumped. Any help would be appreciated.
This person is a fucking douchebag, they should die.
kode54
Zealot
Posts: 1140
Joined: Wed Jul 28, 2004 3:31 am
Contact:

Re: D3D9 2D Windows 7 issue

Post by kode54 »

I could have swore that the texel coordinates were centered between pixels, and thus need to be offset by 0.5.
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Re: D3D9 2D Windows 7 issue

Post by mudlord »

Yep, you're right.

http://stashbox.org/957770/fixed.jpg

I filled out the entire array by hand with adding 0.5 offsets as needed, fixed it.
This person is a fucking douchebag, they should die.
Post Reply