• Advertisement

Archived

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

How to copy surface rect to texture rect??

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

What should i do? I try lock texture, then lock surface, then CopyMemory(texture.pBits,surface.pBits,height*width); I try to get underlying surface via GetSurfaceLevel, what''s wrong?

Share this post


Link to post
Share on other sites
Advertisement
What you wanna use is CopyRect, which doesn''t require you to lock the surfaces. In fact, if you do, it won''t work...
Plus, there is something called pitch you need to take into consideration when you''re doing your own routines.
Pitch is the TRUE width of the surfaces in D3D, and it might be bigger than the visible width, due to some caching-stuff.
You may also have different pitch on the source and destination surfaces, which makes it even worse... So stick to CopyRect


--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Share this post


Link to post
Share on other sites
But how can i get texture surface to use CopyRects, via GetSurfaceLevel ? Cause CopyRects accepts two surfaces, and after copying i need to use texture, i don''t need surface, cause i can''t use SetTexture with surface, right?

Share this post


Link to post
Share on other sites

  • Advertisement