开发者

Loading just a part of a texture in DirectX?

If I have a texture file how would I be able to load up only a par开发者_StackOverflowt of it using a defined rect (top, left, bottom, right)?

Is it technically possibly to only read in the parts I want to load while leaving the rest of the texture untouched?


What exactly are you trying to achieve. Its pretty simple to load up only a small part of a file into a single texture that encompasses it all. You'll probably need to write your own image parser, though.

If you want to load a partial image into a texture thats the same size as the original image (ie only update the area you are after) then this is relaitvely simple as well. You can LockRcts with a rect that is the area you want you update. You'll still need to write your own image parser though.

Personally in situations like this I prefer to use my own texture format that is already in the format I'm after ...


Look at D3DXCreateTextureFromFileEx: http://msdn.microsoft.com/en-us/library/bb172802%28v=VS.85%29.aspx

Otherwise, load the portion of the data you require yourself into memory, create an empty texture and lock it and copy the data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜