Rendering to a texture, crashing on create texture

nikhilhs

Member
Joined
Feb 22, 2004
Messages
22
I have the following code to render to a texture:
Code:
Bitmap bm=new Bitmap(512, 512); 
         Texture tex=new Texture(device, 
                        bm, 
                        Usage.RenderTarget, 
                        Pool.Default); 
          
          
         device.SetRenderTarget(0, tex.GetSurfaceLevel(0)); 
         device.Clear(ClearFlags.Target | ClearFlags.ZBuffer , Color.Blue, 1f, 0); 
         SetupCamera(); 
         device.BeginScene(); 
         Draw(); 
         device.EndScene(); 
         device.Present();

Its crashing on creation of the texture. Is there another option other than the bitmap creation?

Thanks.

-Nick
 
Back
Top