Jump to content
  • Advertisement
Sign in to follow this  
hziee

how to get LPDIRECT3DSURFACE9's info?

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

LPDIRECT3DSURFACE9 pSurface the surface can be used as a target surface ,or preserve a texture; the problem is how can i get info and data form the surface? is there any API in DX?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Gage64
How about IDirect3DSurface9::GetDesc()?


what i want to do is:

//render-to-texture
g_App.GetDevice()->SetRenderTarget(0,pRenderSurface);
g_App.GetDevice()->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_ARGB(0,255,255,255),1.0f,0); g_App.GetDevice()
->BeginScene();
//do so render();
Render();
g_App.GetDevice()->EndScene();

//now dump the surface data;
std::ofstream fout ("fout.dd");

D3DLOCKED_RECT stLockedRect;

// (pRenderTexture)->LockRect( 0, &stLockedRect, 0, 0 );
(pRenderSurface)->LockRect( &stLockedRect, 0, D3DLOCK_NOSYSLOCK );

if ( stLockedRect.pBits == 0) //why it is always ==0? it should
{ //contain something!
(pRenderSurface)->UnlockRect( );
fout.close();
return;
}
char *pch=(char *)stLockedRect.pBits;
for (int i=256;i>=0;i--)
{
for (int j=0;j<256;j++)
{
fout.put(*pch++);
fout.put(*pch++);
fout.put(*pch++);
fout.put(*pch++);
// pch+=4;
}
}
(pRenderSurface)->UnlockRect( );
fout.close();
}


why "stLockedRect.pBits == 0" is always coming into existence?

[Edited by - hziee on June 13, 2007 2:01:57 AM]

Share this post


Link to post
Share on other sites
Take a look at the DirectX SDK documentation for IDirect3DSurface9::LockRect(). There are some notes there that might help you. Also, switch to the debug version of D3D and see if you get any debug output that might help you.

Sorry, I don't know much about this, so these are just quick suggestions.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gage64
Take a look at the DirectX SDK documentation for IDirect3DSurface9::LockRect(). There are some notes there that might help you. Also, switch to the debug version of D3D and see if you get any debug output that might help you.

Sorry, I don't know much about this, so these are just quick suggestions.


thank you

the problem is when i don't use RenderTarget, but Load Texture from file,

get the texture's surface.then i can get the data;

like above,first create a texture ,then render some obj to the texture,
now i can't get the texture (or texture's surface)'s data;

i don't know why,does anyone know?

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!