Skip to main content
gamedev.net
🔒 Locked

Use IDirect3DTexture9* as function parameter?

Started by 991060 0 replies 450+ views
Original Post
991060
991060
Hi all: I had a function doing stuff on input textures, I'm not sure how to do this correctly. I want the function to be like this:
HRESULT function(IDirect3DTexture9* input1, IDirect3DTexture9* input2, IDirect3DTexture9** output)
{ 
   IDirect3DTexture9*	    tempTex;
   LPDIRECT3DSURFACE9	    OldRT;
   LPDIRECT3DSURFACE9          NewRT;

   tempTex->GetSurfaceLevel(0, &NewRT);
   m_pd3dDevice->GetRenderTarget( 0, &OldRT );
   m_pd3dDevice->SetRenderTarget( 0, NewRT);
   
   m_pd3dDevice->SetTexture( 0, input1 ); //??

   m_pd3dDevice->SetTexture( 1, input2 ); //??


   m_pd3dDevice->BeginScene();
   .
   .
   .
   m_pd3dDevice->EndScene();

   *output = tempTex;  //??

   m_pd3dDevice->SetRenderTarget( 0, OldRT);
   tempTex->Release();
   OldRT->Release();
   NewRT->Release();
}
I'm not sure if this function is gonna work,especially on the lines with "??", any suggestions? [edited by - 991060 on May 2, 2004 5:45:11 AM]
The sweet of life sucks.
miodragsm
miodragsm
All is OK ( as far as I can tell ) except line:

tempTex->Release();

If you do this output texture ( *output = tempTex; )
will not be valid. If you just want a copy of texture, you''ll have to create new one and copy surface of tempTex on it (not pointer but content of surface!)

Topic Locked

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

Sign in to reply to this topic.