In the constructor i create the texture like this (the image file is 512*512)
HR(D3DXCreateTextureFromFile(gd3dDevice, "sky_bkg1.bmp", &mBkgdTex));mBkgdCenter = D3DXVECTOR3(256.0f, 256.0f, 0.0f);
The window is 1280*800 and I want the texture to be in the same size so that it can be rendered over the whole screen.
Therefore in my drawScene() function I scale it up to the right resultion. (In the CreateWindow() function i send 1280 as the width and 800 as height, they are defined in another file as WIDTH and HEIGHT)
float scalingX, scalingY; D3DSURFACE_DESC bkgdTexInfo; mBkgdTex->GetLevelDesc(0, &bkgdTexInfo); scalingX = (float)WIDTH / bkgdTexInfo.Width; scalingY = (float)HEIGHT / bkgdTexInfo.Height; D3DXMATRIX T,S; D3DXMatrixTranslation(&T, 0, 0, 0); D3DXMatrixScaling(&S, scalingX, scalingY, 0.0f); HR(mSprite->SetTransform(&(T*S))); HR(mSprite->Draw(mBkgdTex, 0, &mBkgdCenter, 0, D3DCOLOR_XRGB(255, 255, 255))); HR(mSprite->Flush());
With this method I want to find out how much i have to scale the texture in order for it to get 1280*800. I then make a scaling matrix to change it's scale as required. However it doesn't work. The image gets bigger but there is a small line around the whole image between it and the windows borders. The image doesnt take up the whole screen like it should do..
If you didn't get the idea of my example i simply want to make a texture to be full screen, it doesnt matter if the quality gets bad or so as long as there are no parts of the texture that ain't visible on the screen.
Btw, the image is also inverted. Up is down and down is up.. I dont understand that either.
Thanks.