Jump to content
  • Advertisement
Sign in to follow this  
PoLiSh_Peta

Need Quick Help

This topic is 5090 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'm loading texture via this function:
LPDIRECT3DTEXTURE8 CSprite::LoadTexture( char* filename, LPDIRECT3DDEVICE8 in_D3DDevice )
{
	//Black is the source color key, or use 0xFFFF00FF for magenta,
	//or use 0x00000000 for no color key.
	D3DCOLOR colorkey = 0xFF000000;

	D3DXIMAGE_INFO SrcInfo;

	D3DXCreateTextureFromFileEx( in_D3DDevice, filename, 0, 0, 1, 0, 
          D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT, 
          colorkey, &SrcInfo , NULL, &Texture);

	return Texture;
}

It has 0,0 for the width and height, so what exactly does that mean? The texture can't have a width and height of 0. My problem is how do I find the center of the texture? I wanna divide the width and height by two, but they're set to 0. I need the center for rotation purposes. Any ideas? -Peta

Share this post


Link to post
Share on other sites
Advertisement
D3DX_DEFAULT (or something similar) is what should be used, however, it's defined as 0, so the code still works. That tells D3DX to load the file at whatever resolution it is (rounded up to a power of 2).

The srcinfo will tell you the original image size, original format, etc.

You can also getleveldesc on the texture with level 0, after the load, to obtain information about the actual size and d3dformat the texture was loaded as.

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!