Sign in to follow this  

Surface to Texture

This topic is 4097 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
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 ^_^

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

This topic is 4097 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this