Example usage for javax.media.j3d Texture2D setMipMapMode

List of usage examples for javax.media.j3d Texture2D setMipMapMode

Introduction

In this page you can find the example usage for javax.media.j3d Texture2D setMipMapMode.

Prototype

public void setMipMapMode(int mipMapMode) 

Source Link

Document

Sets mipmap mode for texture mapping for this texture object.

Usage

From source file:ExTexture.java

private Texture2D loadTexture(String filename) {
    // Load the texture image file
    if (debug)/* www  .j  ava2  s.co  m*/
        System.err.println("Loading texture '" + filename + "'");
    TextureLoader texLoader = new TextureLoader(filename, this);

    // If the image is NULL, something went wrong
    ImageComponent2D ic = texLoader.getImage();
    if (ic == null) {
        System.err.println("Cannot load texture '" + filename + "'");
        return null;
    }

    // Configure a Texture2D with the image
    Texture2D t = (Texture2D) texLoader.getTexture();

    int mode = ((Integer) boundaries[currentBoundary].value).intValue();
    t.setBoundaryModeS(mode);
    t.setBoundaryModeT(mode);

    Color3f color = (Color3f) colors[currentColor].value;
    t.setBoundaryColor(color.x, color.y, color.z, 0.0f);

    int filter = ((Integer) filters[currentFilter].value).intValue();
    t.setMagFilter(filter);
    t.setMinFilter(filter);

    t.setMipMapMode(Texture.BASE_LEVEL);

    // Turn it on and allow future changes
    t.setEnable(true);
    t.setCapability(Texture.ALLOW_ENABLE_WRITE);

    return t;
}