DirectX SDK |
The D3DXLoadTextureFromSurface and D3DXLoadTextureFromFile functions provide parameters to update existing textures with new data. For example, the following code fragment loads a texture with a D3DXLoadTextureFromFile function call:
hr = D3DXLoadTextureFromFile( m_pD3DDev, pFace, // destination D3DX_DEFAULT, // all mip levels pszTex, // source NULL, // entire source NULL, // entire destination D3DX_FT_DEFAULT);
If you are using the RECT structure parameter (for example, if you are only intending to update a portion of the destination rectangle or a portion of the source rectangle), then the Direct3DX utility library provides helper functionality for scenarios where the source or destination rectangle was not resized due to rasterizer constraints.
The application should setup the RECT structures as if the textures were not resized because Direct3DX will automatically interpret the RECT structures to account for any resizing. This provides a simple mechanism for applications to ignore resizing operations done by Direct3DX. However, if you created the surface outside of Direct3DX, then the RECT structures must correspond to the actual pixel size of that surface.