Skip to main content
gamedev.net
🔒 Locked

Surface Copy

Started by Aragon 8 replies 350+ views
Original Post
Aragon
Aragon
hi only a litte question is there any example how to copy backbuffer surface to an texture (i tryed d3dxloadsurfacefromsurface-> but i didnt get it to run) using dxsdk8.1 thx, and happy new year
Pseudo
Pseudo
Most cards don''t support texture of arbitrary size (they need to be powers of 2 in size) so your back buffer wont be able to just be copied to a texture because the sizes cant match up. You have two options then. Make a really big texture so the back buffer only fills part of it, or you can scale the backbuffer down. With this in mind, you only need to get the surface (DDraw object) from the texture, and do the blit from one surface to another.

Just curious, what type of effect are you using this for?
Aragon
Aragon
this curious thing is for an brand new low resources
mirror effect (not cube), when i get this function to run i
show it at the "screenshots of your engine" post here,
believe me..test with loaded screenshots are absolut great,
i only need to copy the backbuffer...

my texture have the same size and format
(for example 800x6000 X8R8G8B8)
like the backbuffer

but every thing i try to copy fails:

can you give me a litte example how to copy
, i cant find any solution anywhere,
i believe i am the only one that uses a function like this
,but when it runs look at the screenshots

(i am more experienced in programming netcode for this mmorpg than in directx)

thx to everybody




[edited by - Aragon on January 1, 2003 1:49:19 PM]
JonnyQuest
JonnyQuest
How about you just use a texture as a render target? That''s by far the quickest and easiest method.

- JQ
Full Speed Games. Are back.
~phil
Aragon
Aragon
did you have a little example how
to render to an texture?
thedo
thedo
Yeah - I''d render to a texture display that texture and then use it as the basis for the display of the mirror. OK that way the display in the mirror will be 1 frame behind but as long as you keep to 60fps upwards noone should notice.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
Cybertron
Cybertron
If you need a screenshot in DX8 check this out! http://www.geocities.com/foetsch/d3d8screenshot/d3d8screenshot.htm
Aragon
Aragon
for screenshots i take

d3dxSaveSurfaceToFilaA

and this works perfect





*buhuhuhu, nobody understand me*

on my Amstrad CPC 664 in the year 1986
it looks like this


DIM Textur [800,600]
DIM Backbuffer [800,600]

for int tt=0 to 800
for int t =0 to 600

textur[t,tt]=backbuffer[t,tt]

end t
end tt




JonnyQuest
JonnyQuest
Most graphics cards have problems with textures that aren''t powers of 2. Therefore, if you need to use an existing rendering result, you are usually best off rendering to a texture.
To do this, create a texture in the DEFAULT pool and set it as the render target (IDirect3DDevice?::SetRenderTarget()). Look this up in the SDK documentation, it explains everything there. Then set the render target back to the backbuffer and use the newly rendered texture with SetTexture().


- JQ
Full Speed Games. Are back.
~phil
thedo
thedo
ID3DXRenderToSurface?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3dx/interfaces/id3dxrendertosurface/_id3dxrendertosurface.asp

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Topic Locked

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

Sign in to reply to this topic.