Papaervision 3D Programming Tutorial - Web Photos

Posted Mar 06, 2009 by mcasperson / comments 0 comments / Print / Font Size Decrease font size Increase font size

See how to easily load Papervision textures from the web using the asynchronous Loader class. Demo and source code included.

VIEW THE DEMO
DOWNLOAD THE CODE

In the photo cloud example I showed you how you could present images in a 3D format. The application made use of a number of embedded images, which is great for convenience, but not so good for displaying dynamic images.

In this example I have taken the original photo cloud source and modified it so it loads images from the web instead of referencing embedded resources. The way the Papervision MovieMaterial class operates makes this quite easy. By default the MovieMaterial classes created as a texture source for the photos is given a default embedded image, in this case a generic "loading" image. We then create a function in the ResourceManager called loadResources which starts downloading images from the web using the Loader class. We attach an anonymous function to the complete event, which then takes the downloaded image and updates the internal texture of the MovieMaterial.

The beauty of this system is that the application will load and run quickly, and once the images have finished downloading the new textures simply replace the default loading image. We don't really have to worry about the asynchronous loading of the web images.

This example references 4 image via a static URL, but the same concept could be used to download Flickr images, website thumbnails, the latest weather satellite images or any image that is downloadable over the internet. In fact my first attempt at this application was to get web site thumbnail images from the websnapr service - it worked well except for the fact that I got a whole lot of "request in the queue" thumbnails.

Back to Papervision Tutorials

Rate this Article:

Be the first to rate me.


* You must be logged in order to leave comments, please login or join us.

Comments

No comments yet.



Bookmark and Share
Sign up for our email newsletter
Name:
Email: