Jump to content
  • Advertisement
Sign in to follow this  
niazware

Image problem

This topic is 4432 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 D3DX
D3DXIMAGE_INFO theInfo; // Information about the image D3DX loaded

D3DSURFACE_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]

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
EDIT: You can't quote source code? :/

Try [ code ] tags.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!