How to copy texture data to another texture ??

How to copy texture data to another texture ??

Post by Anis Refou » Mon, 24 Nov 2003 22:56:01


Hi , i need some help in order to copy the bits of a
texture in format D3DFMT_P8 (png file 8 bit) onto another
which has been created with D3DXCreateTexture with format
A8R8G8B8

I tried to do so with the lock function and a copymemory
of the bits contained in pBits of D3DLOCKED_RECT

this doesn't work , could anyone help me on this subject ?

Thanks.
 
 
 

How to copy texture data to another texture ??

Post by Eyal Tele » Mon, 24 Nov 2003 23:37:29


You can do it with StretchRect as long as the texture you're copying
to is a render target texture.

Copying the data directly won't work because these are two different
formats, so have different representations. You should be able to do
such a copy if you translate each P8 texel to ARGB before storing it
in the ARGB texture, although this method of copying will be quite
slow (but still okay if you only do it once).

Eyal

 
 
 

How to copy texture data to another texture ??

Post by anonymou » Tue, 25 Nov 2003 01:48:21


another
format
copymemory
subject ?
you're copying
two different
be able to do
before storing it
will be quite
It's ok but i doesn't obtain the right data plotted on
screen (noise of color) ... :(
another idea about it ? (my destination texture is
rendertarget format A8R8G8B8 and D3DPOOL_DEFAULT )
 
 
 

How to copy texture data to another texture ??

Post by legalize+j » Tue, 25 Nov 2003 02:48:14

[Please do not mail me a copy of your followup]

Eyal Teler < XXXX@XXXXX.COM > spake the secret code
< XXXX@XXXXX.COM > thusly:



While StretchRect can handle format conversion, it probably won't
handle this format conversion. In fact, I'd expect it to fail
outright. Use SurfaceLoader.FromSurface to handle format
conversions.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
< http://www.yqcomputer.com/ ~legalize/book/>
Pilgrimage: Utah's annual demoparty
< http://www.yqcomputer.com/ >
 
 
 

How to copy texture data to another texture ??

Post by Anis REFOU » Tue, 25 Nov 2003 04:14:15


what do you talk about ? this : D3DXLoadSurfaceFromMemory
i don't find smthing else matching a surface loader

thanx
 
 
 

How to copy texture data to another texture ??

Post by Eyal Tele » Tue, 25 Nov 2003 06:03:17

> While StretchRect can handle format conversion, it probably won't

Yes, the docs say just YUV to RGBA, if I understand them correctly. I
forgot about that.

Eyal
 
 
 

How to copy texture data to another texture ??

Post by legalize+j » Wed, 26 Nov 2003 02:10:30

[Please do not mail me a copy of your followup]

(Rich) legalize+ XXXX@XXXXX.COM spake the secret code
< XXXX@XXXXX.COM > thusly:


Sorry, I got confused between managed and unmanaged newsgroups.

SurfaceLoader.FromSurface is the managed equivalent of
D3DXLoadSurfaceFromSurface.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
< http://www.yqcomputer.com/ ~legalize/book/>
Pilgrimage: Utah's annual demoparty
< http://www.yqcomputer.com/ >