Sign in to follow this  

Looking to display a live webpage as a texture on a 3d object in WPF

Recommended Posts

I'm trying to map a live webpage to a 3d shape in a WPF window.

I'm using [url=""][/url] (1.7 RC2) for the webview and [url=""][/url] for the 3d objects.

<p:Spherical3D ParallelCount="30" DefaultTextureMapping="True">
<ImageBrush TileMode="None" Stretch="Fill"
ImageSource="{Binding Path=WebTexture, ElementName=MyWpfWindow}" />

Code Behind:
public MainWindow()
_webView = WebCore.CreateWebView(800, 600);
_webView.LoadURL(new Uri(@""));
while (_webView.IsLoading)
var buffer = (BitmapSurface)_webView.Surface;
var bitmap = new WriteableBitmap(800, 600, 96, 96, PixelFormats.Bgra32, null);
buffer.CopyTo(bitmap.BackBuffer, 800, 4, false, false);
WebTexture = bitmap;

private ImageSource _webTexture;
public ImageSource WebTexture
return _webTexture;
set { _webTexture = value; RaisePropertyChanged("WebTexture"); }

I know I'm loading the webpage correctly, and the Spherical3D object shows up just fine if I use a jpg as the ImageSource for the ImageBrush (no binding). But for some reason the GET request isn't being called, so I can't even test to see if my copy is working.

So, question #1, how do you turn a WriteableBitmap into the texture for an ImageBrush?
Or is there a better way to do all this?

2 hours of google/bing/duckduckgo didn't bring up anything so any help would be great.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this