Archived

This topic is now archived and is closed to further replies.

miodragsm

Writing to texture in DirectX8.1

Recommended Posts

1) A static texture which hasn''t been created with D3DUSAGE_DYNAMIC can still have Lock() called on it. It''s just slow to do, so you usually only want to Lock() and fill a static texture once when its created and (after unlockig) leave it alone after that.

2) SetRenderTarget() lets you render to the texture so anything you can draw with Draw*Primitive*() you can do on your texture.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
A viable 3rd alternative:

Use
IDirect3DDevice9::CreateTexture() to create a texture, note to use D3DPOOL_SYSTEMMEM when you create, and also create it of the same format as the texture you want to create.

Then Lock this texture and fill the data in as needed.

Afterwards, create a 2nd texture this time a D3DPOOL_DEFAULT one and it doesn't have to be DYNAMIC.

Now you can use:

IDirect3DDevice9::UpdateTexture( SysMemTexture, DefaultTexture)

Which will allow you to fill the texture with any arbitrary data.

-------
Homepage: http://students.washington.edu/andrey

[edited by - Wreakon on May 2, 2003 6:57:46 PM]

Share this post


Link to post
Share on other sites