Jump to content
  • Advertisement
Sign in to follow this  
null Alaska

how to get texture color information?

This topic is 4841 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

i have succeeded set the render target to texture and set back to orignal frame buffer. then i want to use the texture color information to do something. but i failed to lockrect the texture?(...i don't know what's wrong...) bellow is snippet code: //================================================================== //get original render target (A) //create texture as rendertarget (B) //set (B) as render target //render //set back render target as (A) //save texture to file, and the file is ok //now i want lock the texture to get the color info, but failed hresult = pD3DTexture->LockRect(0, &workRect, NULL, 0); if(FAILED(hresult)) { if(D3DERR_INVALIDCALL == hresult) { //always get here in debug mode } } pD3DTexture->UnlockRect(0); //======================================================================= i also try the texture surface and lock it, but also failed anyone knows which problem there, why always get a invalidcall result? thanks for any help. Sincerely, Alaska.

Share this post


Link to post
Share on other sites
Advertisement
MSDN:
D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT.
Textures placed in the D3DPOOL_DEFAULT pool cannot be locked unless they are dynamic textures or they are private......
============================================================================

so i create another texture with D3DPOOL_SYSTEMMEM (T), and use the GetRenderTargetData to copy the texture surface data. then lock (T) and access it.

Is there others way to get the pixle information of frame buffer?
thanks for any help.

Sincerely,

Alaksa.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!