Sign in to follow this  
Sync Views

converting textures

Recommended Posts

Sync Views    139
How do I convert this texture:
	if(FAILED(D3DXCreateTexture
		(cgm::d3d_device,
		w, h,
		1,
		D3DUSAGE_RENDERTARGET,
		D3DFMT_A8R8G8B8,
		D3DPOOL_DEFAULT,
		&image))) return -1;


Into one like this?
	if (FAILED(D3DXCreateTextureFromFileEx
		(cgm::d3d_device, path, 0, 0, 1, 0, 
		D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT, 
		colour, &scr_info, NULL, &texture)))return -1;


I looked arond on the msdn and google but there doesn't seem to be a "copy" or "D3DXCreateTextureFromTexture" function and as the 2nd one can't be used as a render target I can't just draw one onto the other (as I can the other way around):(

Share this post


Link to post
Share on other sites
Mr Krackers    122
Quote:
Original post by Sync Views
if(FAILED(D3DXCreateTexture
(cgm::d3d_device,
w, h,
1,
D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
&image))) return -1;


Why can't you just add "...FromFileEx" onto that function and go from there?

-EDIT- To Sync Views (two posts down)

I'm sorry, but I still am not sure what the problem is. Why can't you just edit your "D3DXCreateTexture" code and change "D3DPOOL_DEFAULT" to "D3DPOOL_MANAGED".
If the answer is obvious, I'm sorry for my stupidity.

Thanks for your patience.

-EDIT-

Forgive me if I'm wrong, but it seems like you want to covert an off-screen texture into a file-texture.
You may want to try here.

I'm sorry if this isn't what your looking for. To tell the truth, I just started programming and I shouldn't have tried to help you in the first place. Sorry.

[Edited by - Mr Krackers on March 4, 2008 9:34:38 AM]

Share this post


Link to post
Share on other sites
yewbie    677
I have never dabbled in 3d, but I know directx7 has some nice functions to convert pixel formats, although I don't think you mean that.. considering it looks like these are both on the same pixel format.

Share this post


Link to post
Share on other sites
Sync Views    139
@Mr Krackers
because it's not in a file...the second one is just an example of loading into thet format froma file because I don't know how to load from anything else... (and the only other functions ive found are for loading from resources so that still doesn't help much...


create render target
\/
set as render target
\/
render a bunch of stuff onto it
\/
convert it to a D3DPOOL_MANAGED texture to protect it from lost devices <<how?
\/
use it as a texture

Share this post


Link to post
Share on other sites

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