Jump to content


image data in memory--how to load it into back buffer??


3 replies to this topic

#1 celu

    New Member

  • Members
  • PipPip
  • 20 posts

Posted 23 November 2006 - 02:48 PM

i have my image data in an array.i want to load it onto the back buffer.it tried a number of ways..including creating a plain surface and then trying the D3DXLoadSurfaceFromFileInMemory() function. But when i pass the pointer to the array the function fails.Can i pass the array pointer directly to this function?

or should i may be create an HBITMAP object from this array before passing it to this function?....or is there any other easier way for loading my backbuffer with this image data....HELP!!!

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 23 November 2006 - 05:49 PM

Just lock the backbuffer to get a pointer, then copy the image data directly into it.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Oybl

    New Member

  • Members
  • PipPip
  • 17 posts

Posted 23 November 2006 - 05:51 PM

You can only copy to backbuffer from renderttarget textures with StretchRect (or from plain surface, but the dimensions must be the same).

#4 Nils Pipenbrinck

    Senior Member

  • Members
  • PipPipPipPip
  • 597 posts

Posted 23 November 2006 - 06:42 PM

unless you have a very good reason to do it with the CPU, load the image into a texture and blit it onto the backbuffer.

That'll be a lot faster.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users