Jump to content
  • Advertisement

Archived

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

Teric

Creating a texture in code

This topic is 5614 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
Advertisement
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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!