Archived

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

How would I go about creating my own textures in directx?

This topic is 5501 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 mean, I don''t want to use the D3DXLoadFromFile... or whatever, I want to do all the creation myself, like I need to do in OpenGL. Only how.... could someone help me with this fairly simple task??... "What is darkness? It doesn''t exist where there''s light, and without light, it''s nothing..."

Share this post


Link to post
Share on other sites
Very terse explanation, since I'm about to head off to bed:

1) Create a texture ( IDirect3DDevice8::CreateTexture ) with however many MIP levels you want
2) For each MIP level, call IDirect3DTexture8::LockRect and fill in the pixel data in the locked rect
3) Remember to call UnlockRect on each level also, but you might want to keep the previous level locked while you downsample the data. You can alternatively downsample from the top-level (source) bitmap data if you're using some fancy MIP generation algorithm

You'll need to read up on the docs to understand the proper usage of this stuff, and make sure you handle things like the pitch of the surface as compared to the width*bytedepth.

[edited by - Assassin on November 21, 2002 4:36:08 AM]

Share this post


Link to post
Share on other sites