Skip to main content
GameDev.net gamedev.net
🔒 Locked

Back Buffer & StretchRect Problems !!

Started by ClementLuminy Dec 20, 2005 at 10:43 AM 3 replies 3.1k views
Original Post
ClementLuminy
ClementLuminy
Hello ! I'm trying to copy my backbuffer to an other render target texture which is 4 times smaller. My scene is composed by a unique object which do not fill the entire screen My original backbuffer has the X8R8G8B8 format and the other rendertarget the A8R8G8B8 Format. i use the DISCARD method to switch my back buffer. if i copy the backbuffer to the texture using IDirect3DDevice9::StrecthRect() the resulting texture represent correctly the object, but the background is set to an "undefined" color (Sometimes green, Sometimes red ... ) The problem is that the background color IS DEFINED, because i do a IDirect3DDevice9::Clear() before the object is render to the BackBuffer. The only solution i have found, is to render the object a second time into the Texture, but i get two DrawPrimitive Call ..... This problem is driving me crazy ... If anyone can me me some advices, please let me know... Clément
DrunkenHyena
DrunkenHyena
I assume you're calling StretchRect after Present, but before you Clear.
The green and red you're seeing are the colours that the debug runtime uses to clear the backbuffer after you call Present when the swap method is DISCARD. Try calling it just before Present and see what happens.
Stay Casual,KenDrunken Hyena</FON
don
don
Try CheckDeviceFormatConversion to ensure that StretchRect can successfully convert between the two formats.
ClementLuminy
ClementLuminy
Hello !

The StretchRect is after the clear and before the Present ,
so "normally", the back buffer is already filled with black pixel ( for exemple)...
I've tried to change the place of this fonction call, but the result is still the same.


The most "strange" thing is that it only do not work in full screen Mode,
in windowed mode, everything seams to work fine ...


Thanks a lot for your help !
SimmerD
SimmerD
the green and red are from the debug d3d runtime, telling you that you didn't clear the target first.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.