Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista Tutorial - Issues using RenderTargetBitmap with a Viewport3D

 
 
Old 10-22-2008   #1 (permalink)
Tom Angert
Guest


 
 

Issues using RenderTargetBitmap with a Viewport3D

I am attempting to save out an image of a Viewport3D using RenderTargetBitmap
but the image is not matching what I'm seeing in the Viewport3D.

The code is straightforward enough...

// Begin code
int width = (int)myViewport3D.RenderSize.Width;
int height = (int)myViewport3D.RenderSize.Height;

RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, 96,
96,
PixelFormats.Pbgra32);

bmp.Render(myViewport3D);

JpegBitmapEncoder jpgEncoder = new JpegBitmapEncoder();
jpgEncoder.QualityLevel = 100;
jpgEncoder.Frames.Add(BitmapFrame.Create(bmp));

using (Stream stream = File.Create(@"C:\temp\output.jpg"))
{
jpgEncoder.Save(stream);
}
// End code

The jpg gets created, it's the right size and has some of the contents in my
viewport displayed in it, but not all. Some of the ModelVisual3D's are not
displayed, some are only partially displayed and some look great. It
definitely does not match what I see on the screen at the time the snapshot
is taken.

Has anyone seen this behavior before? Any thoughts/suggestions/questions?

Tom.

My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46