Jump to content
  • Advertisement
Sign in to follow this  
XVincentX

Load a texture without d3dx

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

Advertisement
IDirect3DDevice9::CreateTexture() or D3DXCreateTexture() to create the texture. IDirect3DTexture9::LockRect to get a pointer to update the data, then IDirect3DTexture9::UnlockRect when you're done.

You can get data to put in the texture however you want, such as libPNG, or your own loading code for a particular format (TGA is pretty simple), or having Win32 load a BMP and copying that data over, or generating a texture in code.

Share this post


Link to post
Share on other sites
You can also create the texture, retrieve the underlying IDirect3DSurface9 interface (GetSurfaceLevel), then get the associated GDI device context (GetDC) and use GDI's BitBlt or StretchBlt to copy from another GDI DC to initialize the texture.

While BitBlt/StretchBlt will do color-conversion to the target format, it doesn't know anything about alpha channels (or at least didn't the last time I wrote a texture loader some 5 years ago).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!