Jump to content
  • Advertisement
Sign in to follow this  
Thors1982

Sprite Problems with different DPI

This topic is 4351 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

hey, I have been trying to get my own textures to work in this 2d Tile Map I made/copied/modified from a book. Basically my Tiles were 64x64 pixels, 96 dpi and a 24 bit depth. If you right click and go to properties on the Icon. Anyways the tiles do not appear correctly with my Tile Map. The program like doesn't read the texutre correctly it only reads like 2/3rds of the tile. But if I use the tiles that came with the book which are 64x64 pixels, 71 dpi and a 24 bit depth it works perfectly. First question is I don't even know what dpi is, I thought pixels/color depth was the only two I had to worry about... Should I make all mine 71 dpi? Can DirectX use 96 dpi? If so how? If I convert all my tiles from 96 dpi to 71 dpi is that going to make them look worse? Any more information on this topic would be greatly appreciated :-)

Share this post


Link to post
Share on other sites
Advertisement
DPI should not even come into this. I think that's just a value saved with the file by your paint package and actually has no bearing on the final image whatsoever. As far as I know, DirectX does not read the DPI values, nor would it have anything to do with it. Perhaps there is some other problem with the format. What file format are you using? And what program do you create the files with? And how do you read them in for use by DirectX?

Share this post


Link to post
Share on other sites
Bitmap, I am thinking about switching to PNG though

code to read in texture
D3DXCreateTextureFromFileEx(g_pd3dDevice, "Common\\Landscape.bmp", D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_TRIANGLE, D3DX_FILTER_TRIANGLE, D3DFMT_A8R8G8B8, NULL, NULL, &textureLandscape)

code to display sprite
sprite->Begin(D3DXSPRITE_ALPHABLEND);
sprite->Draw(textureLandscape,&Rect,&D3DXVECTOR3(0,0,0),&D3DXVECTOR3((float)screenx, (float)screeny, 0), 0xFFFFFFFF);
sprite->End();

right now I am using tiles I got from another game (cause i am no artist and im just trying to learn to program with directX). Anyways, I have been using paint to put them all together in one file. I just tried to use Gimp and turned it into a 72dpi PNG and it had the same problem.

What file format should I be using? and any reason why this would be happening basically. It is just not copying the right amount of pixels its only doing like 2/3rds of the tile.

[Edited by - Thors1982 on June 25, 2006 5:52:26 AM]

Share this post


Link to post
Share on other sites
I have been trying to figure this problem out for many hours now

and, only thing I can come up with is im not saving it right or creating the file correctly, cause if I just edit the file that came with the book it works perfectly. But if I create my own from scratch or from other tiles it doesn't work.

The pixels like don't match up I can open it up with any paint program and see at 44 the new tile starts but if i do put tile 1 at 0 width of 44 i only see like 2/3rds of the tile.

Share this post


Link to post
Share on other sites
Your D3DXCreateTextureFromFileEx line seems to be expecting a 32 bit per pixel format; this may be a problem, so try D3DFMT_UNKNOWN or D3DFMT_FROM_FILE for the 7th parameter instead perhaps? Also, your 11th parameter appears to be invalid, according to the docs I see. I believe it's supposed to be a D3D colour value, so you might want to double-check it.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!