Skip to main content
GameDev.net gamedev.net
🔒 Locked

texturing + viewing distance problem

Started by shenglong Aug 27, 2011 at 1:52 AM 0 replies 1.2k views
Original Post
shenglong
shenglong
hello i have two different texturing methods but the first one disappears when i move away from the textured quad while the second remains visible at a much further distance, any ideas what im doing wrong ? thanks in advance.


void Quad::SetTexture(float width, float height, unsigned char* pcx)
{
SafeRelease(mTexture); // make sure its empty first

HR( D3DXCreateTexture(gd3dDevice, (UINT)width, (UINT)height, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &mTexture) );

D3DLOCKED_RECT bits;
size_t size = size_t(width * height * 4);

HR( mTexture->LockRect(0, &bits, NULL, 0) );
memcpy(bits.pBits, pcx, size);
HR( mTexture->UnlockRect(0) );
}



void Quad::SetTexture(char* filepath)
{
SafeRelease(mTexture); // make sure its empty first

D3DCOLOR colorkey = 0xFFff00ff; // transparent colour

HR(D3DXCreateTextureFromFileEx (gd3dDevice, filepath, 0, 0, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT,
colorkey, NULL, NULL, &mTexture));
}


shenglong
shenglong
found out where i was going wrong, set mipmaps level to 1, job done

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.