Jump to content
  • Advertisement
Sign in to follow this  

Copying one texture onto another

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

I am trying to 'paste' one 16 bit (with alpha channel) direct3d texture onto another one. The pasted texture may be pasted at any position relative to the base texture. So far I have managed to access and change the base texture, but simply setting each pixel individually to 0 is fairly slow, and I can see that when I am reading from boths textures, calculating the result, and writing to one texture, that the whole process is going to be slower that the process I am trying to optimise (combining multiple textures and copying one texture to the screen rather than copying them all each screen refresh). Here is part of my code (Delphi):
  Image := IDirect3DTexture9(GetImagePointer(ImageID));
  Width := GetImageWidth(ImageID);
  Height := GetImageHeight(ImageID);

  RectPtr^.Left := 0;
  RectPtr^.Top := 0;
  RectPtr^.Right := Width;
  RectPtr^.Bottom := Height;


  Depth := LockedRect.Pitch div Width;

  for x := 1 to Height*LockedRect.Pitch do begin
    PByte(LockedRect.pBits)^ := 0;

Is there any faster way to blend two textures, or part of two textures, together? Thanks for any help.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!