Rendering to a texture, crashing on create texture

nikhilhs

Newcomer
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();

It's crashing on creation of the texture. Is there another option other than the bitmap creation?

Thanks.

-Nick
 
Back
Top