Loading Image Files
<< previous | Chapter 6. Graphics and Sound | next >>

## Loading Image Files

### Changed in breve 2.0

The methods used for loading images have been changed from breve 1.x, so pay close attention to this section if you're updating your simulation from a previous version of breve.

breve can use image files to display objects as bitmaps, texture objects, and to display objects as lightmaps. These techniques are described later in the chapter. This section describes how image files can be loaded into breve.

breve supports loading images in PNG, JPEG or SGI format. PNG is the preferred file format because it supports transparency, which is useful for image textures and bitmaps.

Prior to version 2.0, breve required all images loaded into breve to be square, and for the dimensions of the images to be a power-of-two (for example, 256x256 or 128x128 pixels). This is no longer strictly required, though it is still preferable when using images as object textures. breve will automatically surround the image with a transparent border in order to fulfill the power-of-two size requirements, so images that are not powers of two may not appear as intended.

Images are loaded using the class Image. To load an image file, create a new instance of the class Image, and load a file with the load method:

            image = new Image.
            image load file "myimage.png".

Once an image file has been loaded, it can be used as a bitmap, texture or lightmap, as described later in this chapter.

<< previous | Up | next >>
Shadows and Reflections | Table of Contents | Displaying Objects as Bitmaps