Jump to content
  • Advertisement
Sign in to follow this  
CJWR

help with copying a directx surface.

This topic is 4884 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 have the following two directx surfaces: LPDIRECTDRAWSURFACE4 lpddsprimary; //dd primary surface LPDIRECTDRAWSURFACE4 lpddsback; //dd back surface i want to copy lpddsback to lpddsprimary, while leaving lpddsback the same. (ie, not page flipping) how can i do this? thanks. [Edited by - CJWR on July 29, 2005 6:20:47 AM]

Share this post


Link to post
Share on other sites
Advertisement
wow, i thought is would have been an easier question to get answered. just writing lpddsprimary = lpddsback; doesn't work by the way, i tried that.

Share this post


Link to post
Share on other sites
You could just set the second surface as render target (its SetRenderTarget) and then render a quad that fills the entire screen with a texture containing the data from surface 1. Textures (in mdx at least) have a member function called GetSurfaceLevel which retrieves the textures surface.
Maybe theres an easier way but this works.

-CProgrammer

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
D3DXLoadSurfaceFromSurface()?

Share this post


Link to post
Share on other sites
i'm using direct draw, i don't think 3d stuff will work. why isn't there a copy function for these things?

Share this post


Link to post
Share on other sites
Quote:
Original post by Simian Man
How about:

memcpy( lpddsprimary, lpddsback, sizeof( *lpddsback ) );

I'm assuming here that they are the same size...


yes, they are the same size. i page flip them every frame. this is just a special case for talking to npcs.

Share this post


Link to post
Share on other sites
Well then memcpy should work. It is defined as follows:

memcpy( void* dest, void* source, size_t size );

It copies "size" bites from "source" to "dest".

The only possible pitfall is if DirectX puts the fact that one is the backbuffer hardcoded in the structure. I don't know anything about DirectX, it may have other stuff in the header that you don't want to copy.

Did it work?

Share this post


Link to post
Share on other sites
Quote:
Original post by Simian Man
Well then memcpy should work. It is defined as follows:

memcpy( void* dest, void* source, size_t size );

It copies "size" bites from "source" to "dest".

The only possible pitfall is if DirectX puts the fact that one is the backbuffer hardcoded in the structure. I don't know anything about DirectX, it may have other stuff in the header that you don't want to copy.

Did it work?


no, it didn't.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!