Example usage for org.lwjgl.opengl GL11 GL_NEAREST_MIPMAP_NEAREST

List of usage examples for org.lwjgl.opengl GL11 GL_NEAREST_MIPMAP_NEAREST

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 GL_NEAREST_MIPMAP_NEAREST.

Prototype

int GL_NEAREST_MIPMAP_NEAREST

To view the source code for org.lwjgl.opengl GL11 GL_NEAREST_MIPMAP_NEAREST.

Click Source Link

Document

TextureMinFilter

Usage

From source file:com.ardor3d.scene.state.lwjgl.util.LwjglTextureUtil.java

License:Open Source License

public static int getGLMinFilter(final MinificationFilter filter) {
    switch (filter) {
    case BilinearNoMipMaps:
        return GL11.GL_LINEAR;
    case Trilinear:
        return GL11.GL_LINEAR_MIPMAP_LINEAR;
    case BilinearNearestMipMap:
        return GL11.GL_LINEAR_MIPMAP_NEAREST;
    case NearestNeighborNoMipMaps:
        return GL11.GL_NEAREST;
    case NearestNeighborNearestMipMap:
        return GL11.GL_NEAREST_MIPMAP_NEAREST;
    case NearestNeighborLinearMipMap:
        return GL11.GL_NEAREST_MIPMAP_LINEAR;
    }/*from   www  . j a v  a2  s  .c om*/
    throw new IllegalArgumentException("invalid MinificationFilter type: " + filter);
}

From source file:com.samrj.devil.graphics.TexUtil.java

License:Open Source License

/**
 * @param filter an OpenGL texture minify filter.
 * @return whether or not the given filter is a mipmap filter.
 *///from   www  .j av a 2  s.co  m
public static boolean isMipmapFilter(int filter) {
    switch (filter) {
    case GL11.GL_NEAREST_MIPMAP_NEAREST:
    case GL11.GL_LINEAR_MIPMAP_NEAREST:
    case GL11.GL_NEAREST_MIPMAP_LINEAR:
    case GL11.GL_LINEAR_MIPMAP_LINEAR:
        return true;

    default:
        return false;
    }
}

From source file:com.voxelplugineering.voxelsniper.util.TextureUtilities.java

License:Open Source License

public static int loadPNGTexture(File file, int textureUnit) {
    ByteBuffer buf = null;/*ww w  . java2  s  . c o  m*/
    int tWidth = 0;
    int tHeight = 0;

    try {
        BufferedImage image = ImageIO.read(file);
        tWidth = image.getWidth();
        tHeight = image.getHeight();
        buf = imageToRGBABuffer(image);
    } catch (IOException e) {
        e.printStackTrace();
        if (file.getName().endsWith("debug.png")) {
            System.exit(-1);
        } else {
            return debugTexture;
        }
    }

    // Create a new texture object in memory and bind it
    int texId = GL11.glGenTextures();
    GL13.glActiveTexture(textureUnit);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);

    // All RGB bytes are aligned to each other and each component is 1 byte
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

    // Upload the texture data and generate mip maps (for scaling)
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, tWidth, tHeight, 0, GL11.GL_RGBA,
            GL11.GL_UNSIGNED_BYTE, buf);
    GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);

    // Setup the ST coordinate system
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

    // Setup what to do when the texture has to be scaled
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_NEAREST);

    OpenGLUtilities.checkGLError("loadPNGTexture");
    if (file.getName().endsWith("debug.png")) {
        debugTexture = texId;
    }
    return texId;
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

private static int translatePrismToGL(int value) {
    switch (value) {
    case GLContext.GL_FLOAT:
        return GL11.GL_FLOAT;
    case GLContext.GL_UNSIGNED_BYTE:
        return GL11.GL_UNSIGNED_BYTE;
    case GLContext.GL_UNSIGNED_INT_8_8_8_8_REV:
        return GL12.GL_UNSIGNED_INT_8_8_8_8_REV;
    case GLContext.GL_UNSIGNED_INT_8_8_8_8:
        return GL12.GL_UNSIGNED_INT_8_8_8_8;
    case GLContext.GL_UNSIGNED_SHORT_8_8_APPLE:
        return 0x85BA;

    case GLContext.GL_RGBA:
        return GL11.GL_RGBA;
    case GLContext.GL_BGRA:
        return GL12.GL_BGRA;
    case GLContext.GL_RGB:
        return GL11.GL_RGB;
    case GLContext.GL_LUMINANCE:
        return GL11.GL_LUMINANCE;
    case GLContext.GL_ALPHA:
        return GL11.GL_ALPHA;
    case GLContext.GL_RGBA32F:
        return GL30.GL_RGBA32F;
    case GLContext.GL_YCBCR_422_APPLE:
        return 0x85B9;

    case GLContext.GL_TEXTURE_2D:
        return GL11.GL_TEXTURE_2D;
    case GLContext.GL_TEXTURE_BINDING_2D:
        return GL11.GL_TEXTURE_BINDING_2D;
    case GLContext.GL_NEAREST:
        return GL11.GL_NEAREST;
    case GLContext.GL_LINEAR:
        return GL11.GL_LINEAR;
    case GLContext.GL_NEAREST_MIPMAP_NEAREST:
        return GL11.GL_NEAREST_MIPMAP_NEAREST;
    case GLContext.GL_LINEAR_MIPMAP_LINEAR:
        return GL11.GL_LINEAR_MIPMAP_LINEAR;

    case GLContext.WRAPMODE_REPEAT:
        return GL11.GL_REPEAT;
    case GLContext.WRAPMODE_CLAMP_TO_EDGE:
        return GL12.GL_CLAMP_TO_EDGE;
    case GLContext.WRAPMODE_CLAMP_TO_BORDER:
        return GL13.GL_CLAMP_TO_BORDER;

    case GLContext.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
        return GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS;
    case GLContext.GL_MAX_FRAGMENT_UNIFORM_VECTORS:
        return GL41.GL_MAX_FRAGMENT_UNIFORM_VECTORS;
    case GLContext.GL_MAX_TEXTURE_IMAGE_UNITS:
        return GL20.GL_MAX_TEXTURE_IMAGE_UNITS;
    case GLContext.GL_MAX_TEXTURE_SIZE:
        return GL11.GL_MAX_TEXTURE_SIZE;
    case GLContext.GL_MAX_VARYING_COMPONENTS:
        return GL30.GL_MAX_VARYING_COMPONENTS;
    case GLContext.GL_MAX_VARYING_VECTORS:
        return GL41.GL_MAX_VARYING_VECTORS;
    case GLContext.GL_MAX_VERTEX_ATTRIBS:
        return GL20.GL_MAX_VERTEX_ATTRIBS;
    case GLContext.GL_MAX_VERTEX_UNIFORM_COMPONENTS:
        return GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS;
    case GLContext.GL_MAX_VERTEX_UNIFORM_VECTORS:
        return GL41.GL_MAX_VERTEX_UNIFORM_VECTORS;
    case GLContext.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
        return GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS;

    default://ww  w.  j  ava  2 s.  c  om
        // don't know how to translate, just hope for the best
        return value;
    }
}