Re: D3DXLoadSurfaceFromMemory problem
- From: "Wessam Bahnassi" <wbahnassi@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Oct 2005 22:27:11 +0300
The image info always returns the closest format that resembles the file's
internal pixel representation. So, for a 24-bit BMP you will get a
D3DFMT_R8G8B8 and so on.
The output texture format can be obtained from
IDirect3DTexture9::GetLevelDesc().
--
Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez
--
In|Structurez Arabic Gamedev Community
www.instructurez.com
"gameMaker" <gameMaker@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AEFCFE74-687F-439A-A9CD-ECB0ABBB2674@xxxxxxxxxxxxxxxx
> So, maybe the ImageInfo returned from this function just tells me the
> original image info? And if I use D3DXGetImageInfoFromFileInMemory()
> maybe
> that will tell me that it has been converted to an alpha texture? I will
> try
> this...
>
>
>
> "gameMaker" wrote:
>
>> That is what is in the D3DXImageInfo structure that is returned from
>> D3DXCreateTextureFromFileEx().
>>
>> hResult = D3DXCreateTextureFromFileEx(
>> pDevice, // Device
>> rTextureID.c_str(), // file to load
>> uiWidth, // Width
>> uiHeight, // Height
>> D3DX_FROM_FILE, // Number of Mip-levels
>> 0, // Usage
>> D3DFMT_A8R8G8B8, // format I want to convert it to
>> pool, // The resource buffer we're using (scratch)
>> D3DX_FILTER_POINT, // filter D3DX_FILTER_NONE, // Mip
>> Filter
>> color_key, // Transparent color key
>> &myTextureValue.m_ImageInfo,// Details about the image.
>> NULL, // Palette entry.
>> &myTextureValue.m_pTexture );// Address of texture loaded.
>>
>> I also found out something else. It works if I do this: When the
>> texture
>> is NOT color keyed, I use the format for the source texture in scratch
>> memory
>> (just like the documentation says). But, when the texture IS color
>> keyed, I
>> use the format for the destination (Dynamic texture). That seems to
>> work.
>> But I am still puzzled as to why my texture in scratch memory is not an
>> alpha
>> texture format?
>>
>>
>> "Wessam Bahnassi" wrote:
>>
>> > How do you know what is the format of the newely created scratch
>> > texture?
>> >
>> > --
>> > Wessam Bahnassi
>> > Microsoft DirectX MVP,
>> > Lead Programmer
>> > In|Framez
>> > --
>> > In|Structurez Arabic Gamedev Community
>> > www.instructurez.com
>> >
>> >
>> > "gameMaker" <gameMaker@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> > news:948D34BD-67D2-4AD5-B21C-A61F2247DBE9@xxxxxxxxxxxxxxxx
>> > > Yes.
>> > >
>> > > It seems that the real problem is when I create my texture with
>> > > D3DXCreateTextureFromFileEx and use a color key, it is not giving me
>> > > back
>> > > a
>> > > texture with alpha. Even when I specify that I want to create a
>> > > D3DFMT_A8R8G8B8 texture, it gives me back the same format as the file
>> > > (D3DFMT_R8G8B8). Is there something I don't know about creating
>> > > textures
>> > > in
>> > > SCRATCH memory? Does D3D treat SCRATCH memory different and decide
>> > > that I
>> > > shouldn't have an alpha texture stored there?
>> > >
>> > > Then, when I copy this texture to my texture in DEFAULT memory, the
>> > > texture
>> > > formats are different (since I assumed that it was going to create an
>> > > alpha
>> > > texture for me).
>> > >
>> > > It seems to work with the directx debug dll, but maybe that is just a
>> > > symptom of something else.
>> > >
>> > > "Richard [Microsoft Direct3D MVP]" wrote:
>> > >
>> > >> [Please do not mail me a copy of your followup]
>> > >>
>> > >> =?Utf-8?B?Z2FtZU1ha2Vy?= <gameMaker@xxxxxxxxxxxxxxxxxxxxxxxxx> spake
>> > >> the
>> > >> secret code
>> > >> <E4C8A7D0-DD56-448E-88D9-3B74C3E5A47F@xxxxxxxxxxxxx> thusly:
>> > >>
>> > >> >I am copying a texture from SCRATCH memory to my texture every
>> > >> >frame.
>> > >> >This
>> > >> >works great with the directx debug dll. But, when I use the
>> > >> >release
>> > >> >version
>> > >> >of directx runtime, my texture looks like the wrong format and
>> > >> >after a
>> > >> >few
>> > >> >seconds crashes with an exception on this line. Does anybody know
>> > >> >why
>> > >> >the
>> > >> >retail version would be different?
>> > >>
>> > >> Are you also compiling your code in release?
>> > >> --
>> > >> "The Direct3D Graphics Pipeline"-- code samples, sample chapter,
>> > >> FAQ:
>> > >> <http://www.xmission.com/~legalize/book/>
>> > >> Pilgrimage: Utah's annual demoparty
>> > >> <http://pilgrimage.scene.org>
>> > >>
>> >
>> >
>> >
.
- References:
- Re: D3DXLoadSurfaceFromMemory problem
- From: Richard [Microsoft Direct3D MVP]
- Re: D3DXLoadSurfaceFromMemory problem
- From: Wessam Bahnassi
- Re: D3DXLoadSurfaceFromMemory problem
- From: gameMaker
- Re: D3DXLoadSurfaceFromMemory problem
- From: gameMaker
- Re: D3DXLoadSurfaceFromMemory problem
- Prev by Date: Re: Progressive Mesh
- Next by Date: Re: Sprite or big vertex & index buffers?
- Previous by thread: Re: D3DXLoadSurfaceFromMemory problem
- Next by thread: Re: 3D Collision
- Index(es):
Relevant Pages
|