DX9 and Textures

DX9 and Textures

Post by Karl G » Tue, 08 Jul 2003 06:54:24



Hello,

I'm trying to load a tiled texture in a .bmp file into
multiple textures in program memory.  I'm having trouble
the the IDirect3DDevice9::CreateTexture and
IDirect3DTexture9::LockRect functions.

First of all, I don't want a full mipmap chain, but
Direct3D INSISTS on building one (the call fails unless I
specify 0 or D3DX_DEFAULT, both of which make a full
chain.)

Ok, that's not so big a deal.  It uses up more memory, but
I can live with it.  Now for the next part:  When I go to
lock the texture so that I can copy data from the loaded
texture into my created one, it decides to give
me "D3DERR_INVALIDCALL" no matter what I do.

Anyone have an idea as to what's going on?

Karl

 
 
 

DX9 and Textures

Post by Cronus3 » Tue, 08 Jul 2003 07:07:04



Quote:> Hello,

> I'm trying to load a tiled texture in a .bmp file into
> multiple textures in program memory.  I'm having trouble
> the the IDirect3DDevice9::CreateTexture and
> IDirect3DTexture9::LockRect functions.

> First of all, I don't want a full mipmap chain, but
> Direct3D INSISTS on building one (the call fails unless I
> specify 0 or D3DX_DEFAULT, both of which make a full
> chain.)

> Ok, that's not so big a deal.  It uses up more memory, but
> I can live with it.  Now for the next part:  When I go to
> lock the texture so that I can copy data from the loaded
> texture into my created one, it decides to give
> me "D3DERR_INVALIDCALL" no matter what I do.

> Anyone have an idea as to what's going on?

> Karl

It would be helpful if you posted your function calls.  What pool are you
creating your texture in?  From the SDK:

"Textures placed in the D3DPOOL_DEFAULT pool cannot be locked unless they
are dynamic textures or they are private, four-character code (FOURCC),
driver formats. To access unlockable textures, you must use functions such
as IDirect3DDevice9::UpdateSurface, IDirect3DDevice9::UpdateTexture,
IDirect3DDevice9::GetFrontBufferData and
IDirect3DDevice9::GetRenderTargetData. "

 
 
 

1. DX9: How to update non-dynamic texture when format is not supported by CreateOffScreenPlainSurface

My target graphics device (a Radeon 7000) claims to support
D3DFORMAT_UYVY textures. This turned out to be true, unless I specify
D3DUSAGE_DYNAMIC, for
which CreateTexture fails.
So I cannot load pixels to the texture by locking/unlocking.

The only way left to load pixel data to the texture is either
UpdateTexture / UpdateSurface or StretchRect.

But now I discovered that the board does not support
off-screen-plain-surfaces
with a format of D3DFORMAT_UYVY.

So I only can create D3DPOOL_SCRATCH surfaces as a source surface to
UpdateSurface / StretchRect. However D3DPOOL_SCRATCH surfaces are not
supported by these methods.

What am I missing? How can I update a texture when I cannot create
Off-Screen-Plain-Surfaces of the same format and can't create the
texture as D3DUSAGE_DYNMAIC? There must be a way, otherwise the
YUV-texture feature would be ueseless...

Please help!

Thanks,
  Jan

2. Amiga graphics at Ohio State

3. Texture from multisampled surface in DX9

4. transforming perspective

5. DX9 Texture Tool FAILED!

6. Antialiasing & SVGA palette problem

7. multisampled texture in DX9

8. How to setup multisampled texture target in DX9

9. multisampled dynamic texture in DX9

10. NO TEXTURES SHOWING UP IN DX9

11. textures not showing up in DX9

12. DX9