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

Locking Render Target

Started by MePHyst0 Oct 13, 2005 at 2:25 PM 3 replies 3.3k views
Original Post
MePHyst0
MePHyst0
Hi, I render some primatives to a texture, then I want to somehow get the data from the texture. Unfortunately I can't find a viable way how to do this so far. I tryed a simple texture.LockRectangle(...), but it obviously fails, because textures in default pool can't be locked and render targets have to be created in default pool. I also tryed device.StretchRectangle(...), but it also fails, the SDK says that I can't copy from a RT texture to a normal texture. please, is out there somebody who knows how to get pixel data from a render target texture? thanks in advance :)
don
don
IDirect3DDevice9::GetRenderTargetData

circlesoft
circlesoft
Note that doing this is going to be pretty dang slow, since render targets exist only in the default pool (video memory). This means when you lock them, they need to be transfered from video memory, back into system memory, which is one of the slowest things you can do.

What are you trying to accomplish? Perhaps you can do this in another way that will improve performance.
MePHyst0
MePHyst0
thanks a lot boys.
But there's one more thing, I noticed that the GetRenderTargetData copies the whole Render target surface to a destination surface, is there a way of copying just a rectangle of the render target to the system memory? for example 1 pixel?

thanks
vNistelrooy
vNistelrooy
Quote:
Original post by MePHyst0
thanks a lot boys.
But there's one more thing, I noticed that the GetRenderTargetData copies the whole Render target surface to a destination surface, is there a way of copying just a rectangle of the render target to the system memory? for example 1 pixel?

thanks


Create a new render target. Render the rectangle you need to this new render target, and copy it to system memory.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Topic Locked

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

Sign in to reply to this topic.