Skip to main content
gamedev.net
🔒 Locked

Surface to Texture

Started by WOsborn Sep 27, 2006 at 2:22 PM 1 replies 900+ views
Original Post
WOsborn
WOsborn
Whats the process for getting the LPDIRECT3DSURFACE9 info onto LPDIRECT3DTEXTURE9 so I can send it to a LPD3DXEFFECT using setTexture(). I have a swapchain _swapchain and a backbuffer _backbuffer I init with: _swapchain->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &_backbuffer ); in my render loop I do: DX9_DEV->SetRenderTarget( 0, _backbuffer ); Clear() BeginScene() Render..... EndScene() _swapchain->Present( NULL, NULL, _win_handle, NULL, 0); now say i wanted to use the _backbuffer render as a texture on a quad for a postprocess setup or something, before that swapchain presents.. how do I get that onto a texture? Ive seen D3DXCreateRenderToSurface() but I dont know much that was supported on older cards. Thanks...
b3rs3rk
b3rs3rk
how did you created your surface? Anyways, you have no need to "put" the surface onto the texture, it's done automatically if at loading time you create the texture then get ITS surface using Texture->GetSurfaceLevel(0, &Surface);
Hope it helps ^_^
circlesoft
circlesoft
Unless you had an IDirect3DTexture9 interface to begin with, you are going to be able to feed it back through the pipeline to do post-processing. The easy solution: instead of rendering the scene to a swap-chain (which just uses surfaces, not textures), render it to your own render-target texture. Then you can do post-processing on it.

You want to create a texture with the following properties:

- Height/Width is screen width/height
- Usage is render-target
- Just 1 mipmap level
- Format should most likely be D3DFMT_A8R8G8B8 (or higher, if you are doing HDRI)

Topic Locked

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

Sign in to reply to this topic.