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

CreateRenderTarget

Started by TheKrust Dec 16, 2007 at 6:26 PM 2 replies 2.2k views
Original Post
TheKrust
TheKrust
So I do the CreateRenderTarget method, it doesn't return and error and everything peachy. Nice... but how exatly do I get this wonderful new surface into a displayable texture? I typically use D3DUSAGE_RENDERTARGET and the GetSurfaceLevel method, but that doesn't seem to be working . I will admit I didn't do that much with it because I don't want to invest too much time in something that's a waste. So anyway, any idea how I can get this to render to a texture? (please no alternative AA proposals, I already know about those)
---------------------------------------- There's a steering wheel in my pants and it's drivin me nuts
Namethatnobodyelsetook
Namethatnobodyelsetook
If you need AA rendering, you make your surface with AA as you're doing, then StretchRect into surface level 0 of a texture.

If you don't need AA, just make a render target texture and render directly into surface level 0.
MJP
MJP
I assume you're doing this resolve a multisampled render target? In that case you use IDirect3DDevice9::StretchRect to copy the data from the multisampled render target to the surface of a texture created with D3DUSAGE_RENDERTARGET. Like this:

//msTarget is the multisampled render targetLPDIRECT3DSURFACE9 rtSurface = NULL;rtTexture->GetSurfaceLevel(0, &rtSurface);d3dDevice->StretchRect(msTarget, NULL, rtSurface, NULL, D3DTEXF_NONE);
TheKrust
TheKrust
Ah, ok I'll give it a shot. I've always seemed to think StretchRect was a slow operation though. How does it measure to speed against direct rendering on a texture?
---------------------------------------- There's a steering wheel in my pants and it's drivin me nuts

Topic Locked

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

Sign in to reply to this topic.