Archived

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

Creating a texture in code

This topic is 5310 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

I''ve created a class to load bitmap data into a BYTE array so I can look at individual pixels and use them in hit maps. Now I want to be able to take the data already stored in my bitmap array and load it into a texture for display in Direct3D. Is this possible? Can I create a texture programmatically by simply telling it what colors to put in what pixels? If so, could someone please point me in the right direction on how to do this? (I''m using DX 8.1) Thanks in advance!

Share this post


Link to post
Share on other sites
use D3DXCreateTexture to create the texture in the format you need(passing 1 for the number of miplevels to keep it from making mipmaps).
then lock the level 0 surface and copy your data over, unlock it and use it.


Share this post


Link to post
Share on other sites