This might been asked/answered before, but done quick search and could not find.
Im currently working on a 2D gui system for D3D10 and looking into using sprites instead of vertex buffer i lock/update each control be drawed.
I pretty much copied the code from the DXUT framework to get my sprite drawn but noticed something strange about the sprite scaling.
My application is running in windowed mode: 800x600
I have a texture loaded to use as background (fill entire render screen) wich is: 1024x786 dimension.
This is my code for drawing the background image:
Notice the line:
D3DXMatrixScaling( &matScaling, 2.0f, 2.0f, 1.0f );
So am i doing something wrong here or is it normal that the scale must be 2.0 for filling the entire screen?
g_pSprite->Begin( 0 );
g_pEffect->GetTechniqueByIndex( 0 )->GetPassByIndex( 0 )->Apply( 0 );
D3DXMATRIXA16 matScaling;
D3DXMATRIXA16 matTranslation;
D3DXMatrixScaling( &matScaling, 2.0f, 2.0f, 1.0f );
D3DXMatrixTranslation( &matTranslation, 0.0f, 0.0f, 0.5f );
D3DX10_SPRITE Sprite;
Sprite.matWorld = matScaling * matTranslation;
Sprite.pTexture = g_pTexture;
Sprite.TexCoord.x = 0.0f;
Sprite.TexCoord.y = 0.0f;
Sprite.TexSize.x = 1.0f;
Sprite.TexSize.y = 1.0f;
Sprite.TextureIndex = 0;
Sprite.ColorModulate = D3DXCOLOR( 1.0f, 1.0f, 1.0f, 0.5f );
g_pSprite->DrawSpritesBuffered( &Sprite, 1 );
g_pSprite->End();