help with copying a directx surface.
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]
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.
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
Maybe theres an easier way but this works.
-CProgrammer
i'm using direct draw, i don't think 3d stuff will work. why isn't there a copy function for these things?
How about:
memcpy( lpddsprimary, lpddsback, sizeof( *lpddsback ) );
I'm assuming here that they are the same size...
memcpy( lpddsprimary, lpddsback, sizeof( *lpddsback ) );
I'm assuming here that they are the same size...
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.
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?
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement