Image problem

Started by
2 comments, last by niazware 17 years, 10 months ago
I've problems in showing images, I use sprites, and sizes of images changes when showed in screen, what do you suggest? what can I use for this problem, I want to use images for my game menu. thanks
Advertisement
This is one of the things getting added to the new forum FAQ I believe. See jollyjeffers' Journal, and my reply:
Quote:All looks good to me. One thing it might be wortwhile mentioning is that you can use GetLevelDesc() on level 0 to find out the size of the texture D3DX actually created, so you can still use non-power-of-2 textures and just adjust the texture coordinates.

E.g.
LPDIRECT3DTEXTURE9 pTexture; // Your texture returned from D3DXD3DXIMAGE_INFO theInfo;      // Information about the image D3DX loadedD3DSURFACE_DESC theDesc;if(FAILED(pTexture->GetLevelDesc(0, &theDesc))){   // Error}float tuMax = (float)theInfo.Width / (float)theDesc.Width;float tvMax = (float)theInfo.Height / (float)theDesc.Height;

Then you can render a quad using (tu, tv) as texture coordinates where you'd normally use (1.0f, 1.0f).

Not sure if it fits in here, but I've seen the question on the DX forum 2 or 3 times in the past few weeks.


EDIT: You can't quote source code? :/
EDIT2: Ah ha, thanks sirob

[Edited by - Evil Steve on June 26, 2006 6:32:54 AM]
Quote:Original post by Evil Steve
EDIT: You can't quote source code? :/

Try tags.
Sirob Yes.» - status: Work-O-Rama.
OK, but what can I do about images? should I use textures and meshes for showing my images for menu and other UI items? currently I'm using D3DXSprite interface and I can't get my images with the desired size, they get bigger or smaller and I can't find a good way to scale them, what's the problem with sprites? Can I use windows API functions in my D3D app?

This topic is closed to new replies.

Advertisement