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

Direct3D - Off-screen Rendering

Started by sbayeta Nov 1, 2005 at 1:23 PM 2 replies 3.4k views
Original Post
sbayeta
sbayeta
Hi, I need to render a scene to an off-screen buffer, so I can manipulate individual pixels in the final image. Is this possible using Direct3D? I'm using the managed API of DirectX 9. Thanks in advance.
neneboricua19
neneboricua19
Quote:
Original post by sbayeta
Hi,

I need to render a scene to an off-screen buffer, so I can manipulate individual pixels in the final image. Is this possible using Direct3D?

I'm using the managed API of DirectX 9.

Yes, this is possible. The idea you're describing is called render to texture or render to surface. Take a look at the HDRCubeMap and HDRFormats managed SDK samples.

However, be warned that rendering to a texture and then trying to manipulate the individual pixels, while possible, is VERY slow. You cannot even lock a renderable texture directly. You must first copy the contents of this surface to a surface created in system memory. Then you can lock this system memory surface and access its pixels. Perhaps there is another way to accomplish what you're trying to do?

If you're coming from OpenGL and are used to glReadPixels, just be aware that it is doing the same thing. glReadPixels needs to copy data from the video card to system memory to allow you to read it.

neneboricua
sbayeta
sbayeta
Quote:

If you're coming from OpenGL and are used to glReadPixels, just be aware that it is doing the same thing. glReadPixels needs to copy data from the video card to system memory to allow you to read it.


This is exactly what I need. Speed is not a concern, since I will render the scene just once. I'll look at the samples you mentioned. Thanks a lot.

Topic Locked

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

Sign in to reply to this topic.