render tot texture

Started by
0 comments, last by Freaker13 20 years ago
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]
Advertisement
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

This topic is closed to new replies.

Advertisement