Load a texture without d3dx
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.
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.
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).
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement