Jump to content
  • Advertisement
Sign in to follow this  
dposton70

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

This topic is 2255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

I'm using http://awesomium.com/ (1.7 RC2) for the webview and http://perspective.codeplex.com/ for the 3d objects.

XAML:

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



Code Behind:

public MainWindow()
{
_webView = WebCore.CreateWebView(800, 600);
_webView.LoadURL(new Uri(@"http://www.youtube.com"));
while (_webView.IsLoading)
WebCore.Update();
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;
InitializeComponent();
}

private ImageSource _webTexture;
public ImageSource WebTexture
{
get
{
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.
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!