Archived

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

Creating texture in D3D

This topic is 5177 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 have created a texture using IDirect3DDevice9 CreateTexture method. Now I need to fill it with the image data. There is a lock rectangle method but it locks only a single level of the texture. Do I need to create and copy the image data to all the texture levels? or is there a way to copy only the topmost level and generate all the rest of the levels?

Share this post


Link to post
Share on other sites
You can fill the first level with your image data and then call IDirect3dTexture9::GenerateMipSubLevels. That should do the trick.

Just in case you''re not aware of it, if your image data is coming from a file, in-memory file, or a resource, you can use D3DXCreateTextureFromFile, D3DXCreateTextureFromFileInMemory, or D3DXCreateTextureFromResource, respectively instead of loading it manually.

neneboricua

Share this post


Link to post
Share on other sites