Copying DX surfaces - problems :(

Started by
2 comments, last by Evil Steve 14 years, 11 months ago
Hi all !! I'm having troubles about copying a surface onto the backbuffer :°°( I know my backbuffer pointer works, because I can draw on it (for example, a bunch of pixels). But when it comes to copy on it another surface, nothing works :( I first tried to use kinda that: m_d3ddevice->UpdateSurface(pSurface, &rect, m_pBackBuffer, &destPoint); but nothing. The I tried in vain: m_d3ddevice->StretchRect(m_pBackBuffer, &rect, pSurface, &rect, D3DTEXF_NONE); But nothing also with: D3DXLoadSurfaceFromSurface (m_pBackBuffer, NULL, &rect, pSurface, NULL, &rect, D3DX_DEFAULT, 0); --- Anyway, what is the best way to load and write an image on a surface, and the copy/write this surface onto the backbuffer ? (I'm trying to make a quake-like console). THANKS A LOT !
Advertisement
1. What do you mean "nothing works"? Does the app crash? Does it render nothing? Does it cause a blue screen of death? Does your computer burst into flames?
2. What do the Debug Runtimes say, and what error code do the functions return?
3. What pool is your surface in? UpdateSurface() only works with the surface in D3DPOOL_SYSTEMMEM and StretchRect() only works with the surface in D3DPOOL_DEFAULT.

EDIT:
Quote:Original post by NiGoea
Anyway, what is the best way to load and write an image on a surface, and the copy/write this surface onto the backbuffer ? (I'm trying to make a quake-like console).
The best way is to use a textured quad and not write directly to the backbuffer at all, since it's pretty slow. The best way of doing it without textured quads depends on how frequently you update your data.
For a Quake-style console, I'd definitely go for the textured quad route.
With "nothing works" I mean that nothing is copied into the BackBuffer, while the application works perfectly. The backbuffer remains untouched, as if the funcions dont' work at all. The Debug Runtime doesn't report any error (I debugged, and any error occurs).

I tried various pool for the source surface, but the destination is the backBuffer, so there is no much I can do. Anyway.. NOTHING works :°(

I was in the need of a function that allows me to copy a surface (a surface that I can fill as I want) to the backbuffer, that's all.

Anyway, thanks for you advice !! I will try to use the texture quad.
UpdateSurface() won't help much, since it needs to update the entire surface (So you'd lose everything apart from the console), and StretchRect() only works with surfaces in D3DPOOL_DEFAULT, which isn't usually good.

Are you sure it's not changing the backbuffer? Are you making any other changes to the backbuffer at all (Including rendering or calling Clear())? Are you saving the contents of the backbuffer to a file after updating it for debugging?
Are you positive that the function isn't failing and there's no debug output?

This topic is closed to new replies.

Advertisement