Jump to content
  • Advertisement
Sign in to follow this  
Sync Views

converting textures

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

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
Advertisement
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
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
@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
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!