Previous Topic Tutorial Home Page Next Topic
Load the Images and Specify the Labels


set the URL bases for importing the media
URL mediaBase = getImportBase();
URL imgBase = buildURL(mediaBase,"image/");
URL sndBase = buildURL(mediaBase,"sound/");
URL geoBase = buildURL(mediaBase,"geometry/");


a [-1, 1] square in X and Y with [0, 1] texture coordinates for both of its faces.
GeometryBvr square =
importGeometry(buildURL(geoBase, "square.x"));

import a list of images, some of these images could have been .gif images
ImageBvr pics[] = {
importImage(buildURL(imgBase, "phantom.jpg")),
importImage(buildURL(imgBase, "hiddenBeachSS.jpg")),
importImage(buildURL(imgBase, "hiddenBeachSG.jpg")),
importImage(buildURL(imgBase, "jotunheimen1.jpg")),
importImage(buildURL(imgBase, "redWoodCar.jpg")),
importImage(buildURL(imgBase, "wenatcheeCascades.jpg")),
importImage(buildURL(imgBase, "tulipsHol1.jpg")),
importImage(buildURL(imgBase, "tulipsHol2.jpg")),
importImage(buildURL(imgBase, "yosemiteCreek.jpg")),
importImage(buildURL(imgBase, "kidsUtah.jpg")),
importImage(buildURL(imgBase, "foliageUtah.jpg"))};

construct a corresponding array of behaviors
ArrayBvr pictures = new ArrayBvr(pics);

ditto for corresponding labels
StringBvr lbls[] = {
toBvr("Phantom Is., Crater Lk., Oregon"),
toBvr("Hidden Beach, Klamath, California"),
toBvr("Hidden Beach, Klamath, California"),
toBvr("Jotenheimen, Norway"),
toBvr("Redwoods N.P., California"),
toBvr("Wenatchee, Cascades, Washington"),
toBvr("Tulip Garden, Holland"),
toBvr("Tulip Garden, Holland"),
toBvr("Yosemite, California"),
toBvr("Centerville, Utah"),
toBvr("Bountiful, Utah")};
ArrayBvr lables = new ArrayBvr(lbls);

Construct a NumberBvr counter object, and use it as an interactive index to select a picture and a corresponding lable.
NumberBvr numPics = lables.length();
NumberBvr index = (NumberBvr) (new Counter(numPics)).getBvr().runOnce();
ImageBvr picture = (ImageBvr) pictures.nth(index);
StringBvr lable = (StringBvr) lables.nth(index);

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

Previous Topic Tutorial Home Page Next Topic