Archived

This topic is now archived and is closed to further replies.

render tot texture

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

hi all, when i render an object to a texture,my materials don't show up. When i render the same object to screen,i see my material. ask if you need some more code but it's a large project and difficult to post the code. anyway here is how i create the rendertexture:
   // Create the texture that will be dynamic.

   if(FAILED(D3DXCreateTexture(D3Ddevice, width, height, D3DX_DEFAULT, 
                          D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
                          &surfaceTexture)))
      {
		   return false;
      }
			
   // Get the surface information.

   D3DSURFACE_DESC desc;
   surfaceTexture->GetSurfaceLevel(0, &offScreenSurface);
   offScreenSurface->GetDesc(&desc);

   // Create the off screen surface that will be used to draw on the dynamic texture.

   if(FAILED(D3DXCreateRenderToSurface(D3Ddevice, desc.Width, desc.Height, desc.Format, TRUE, 
             D3DFMT_D16, &renderToSurface)))
      {
         return false;
      }
thx in advance. [edited by - freaker13 on April 20, 2004 5:45:32 AM]

Share this post


Link to post
Share on other sites
Well, render surfaces usually only have one mipmap level but I don''t think that should cause objects to be rendered without materials.

Are you using SetRenderTarget or are you useing ID3DRenderToSurface::BeginScene to render to your surface? I assume you''re using the second one but just making sure.

Also, have you run this with the reference rasterizer? Does the debug spew output anything important?

neneboricua

Share this post


Link to post
Share on other sites