Jump to content
  • Advertisement


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


Writing to texture in DirectX8.1

This topic is 5709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can i write data into texture surface without locking the texture ( texture is not lockable ) in DirectX8.1 ?

Share this post

Link to post
Share on other sites
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

Share this post

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

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!