Re: copy texture to another texture
- From: "brekehan" <cpisz@xxxxxxxxxxxxx>
- Date: 18 Jan 2007 12:35:47 -0800
Richard [Microsoft Direct3D MVP] wrote:
[Please do not mail me a copy of your followup]
"brekehan" <cpisz@xxxxxxxxxxxxx> spake the secret code
<1169145972.126173.239100@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> thusly:
I have a class that has a LPDIRECT3DTEXTURE9 member. The need has
arisen for me to write a copy constructor. How can I copy one texture
to another without reloading it from file?
Do you need to create a new texture resource whose contents are
identical to the first resource or can you share the same texture
between the two C++ objects?
If the latter, then simply AddRef() the texture interface in the copy
constructor.
If the former, you'll have to create a new resource and StretchRect all
the levels from the source resource to the destination resource.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
I was thinking about the latter, not realizing the first was an option.
I think sharing the resource is viable. Where is the resource contained
and managed? What will happen when I release a texture object and
texture object is still in use?
I'll try and find what I can in the msdn, but in the meantime, wanted
to post my reply anyway.
Here is my scenario:
A dialog parser reads though a .txt file of a bunch of 2d graphics
descriptions.
It comes across a font which is an art image of glyphs.
It creates a font object which in turn splits an image and calculates
texture coordinates.
The font object then creates the texture and holds a pointer to it
as a member
I then have a text area object which has a font as a member
To create the text area a font object is passed as an argument and
"copy constructed" to its member
Thus why I wanted to copy the texture
The idea is that the dialog parser can create a bunch of fonts and pass
in whatever font is needed for any text area it comes across. There may
be several text areas that use the same font. Since, the font contains
the texture, I wanted to copy it over in the text areas constructor.
.
- Follow-Ups:
- Re: copy texture to another texture
- From: Richard [Microsoft Direct3D MVP]
- Re: copy texture to another texture
- References:
- copy texture to another texture
- From: brekehan
- Re: copy texture to another texture
- From: Richard [Microsoft Direct3D MVP]
- copy texture to another texture
- Prev by Date: Re: bad performance when running SimpleSample in fullscreen
- Next by Date: CreateDevice() returns D3DERR_INVALIDCALL
- Previous by thread: Re: copy texture to another texture
- Next by thread: Re: copy texture to another texture
- Index(es):
Relevant Pages
|