Sign in to follow this  

Need Quick Help

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

This topic is 4744 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this