Java Code Examples for android.opengl.GLES20#GL_LINEAR

The following examples show how to use android.opengl.GLES20#GL_LINEAR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextureParameters.java    From ShaderEditor with MIT License 6 votes vote down vote up
private static int shortcutToMin(String shortcut) {
	switch (shortcut) {
		case "n":
			return GLES20.GL_NEAREST;
		case "l":
			return GLES20.GL_LINEAR;
		case "nn":
			return GLES20.GL_NEAREST_MIPMAP_NEAREST;
		case "ln":
			return GLES20.GL_LINEAR_MIPMAP_NEAREST;
		case "ll":
			return GLES20.GL_LINEAR_MIPMAP_LINEAR;
		default:
			return GLES20.GL_NEAREST_MIPMAP_LINEAR;
	}
}
 
Example 2
Source File: TextureParameters.java    From ShaderEditor with MIT License 6 votes vote down vote up
private static String minToShortcut(int min) {
	switch (min) {
		case GLES20.GL_NEAREST:
			return "n";
		case GLES20.GL_LINEAR:
			return "l";
		case GLES20.GL_NEAREST_MIPMAP_NEAREST:
			return "nn";
		case GLES20.GL_LINEAR_MIPMAP_NEAREST:
			return "ln";
		case GLES20.GL_LINEAR_MIPMAP_LINEAR:
			return "ll";
		default:
			return "nl";
	}
}
 
Example 3
Source File: OGLESShaderRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertMinFilter(Texture.MinFilter filter) {
    switch (filter) {
        case Trilinear:
            return GLES20.GL_LINEAR_MIPMAP_LINEAR;
        case BilinearNearestMipMap:
            return GLES20.GL_LINEAR_MIPMAP_NEAREST;
        case NearestLinearMipMap:
            return GLES20.GL_NEAREST_MIPMAP_LINEAR;
        case NearestNearestMipMap:
            return GLES20.GL_NEAREST_MIPMAP_NEAREST;
        case BilinearNoMipMaps:
            return GLES20.GL_LINEAR;
        case NearestNoMipMaps:
            return GLES20.GL_NEAREST;
        default:
            throw new UnsupportedOperationException("Unknown min filter: " + filter);
    }
}
 
Example 4
Source File: RRGLTexture.java    From RedReader with GNU General Public License v3.0 6 votes vote down vote up
private static int loadTexture(final Bitmap bitmap, final boolean smooth) {

		final int[] textureHandle = new int[1];
		GLES20.glGenTextures(1, textureHandle, 0);

		if(textureHandle[0] == 0) {
			throw new RuntimeException("OpenGL error: glGenTextures failed.");
		}

		final int filter = smooth ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;

		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
		GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);

		return textureHandle[0];
	}
 
Example 5
Source File: TextureParameters.java    From ShaderEditor with MIT License 5 votes vote down vote up
public TextureParameters() {
	defaultMin = GLES20.GL_NEAREST;
	defaultMag = GLES20.GL_LINEAR;
	defaultWrapS = GLES20.GL_REPEAT;
	defaultWrapT = GLES20.GL_REPEAT;
	set(defaultMin, defaultMag, defaultWrapS, defaultWrapT);
}
 
Example 6
Source File: TextureParameters.java    From ShaderEditor with MIT License 5 votes vote down vote up
private static int shortcutToMag(String shortcut) {
	if (shortcut.equals("n")) {
		return GLES20.GL_NEAREST;
	} else {
		return GLES20.GL_LINEAR;
	}
}
 
Example 7
Source File: OGLESShaderRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private int convertMagFilter(Texture.MagFilter filter) {
    switch (filter) {
        case Bilinear:
            return GLES20.GL_LINEAR;
        case Nearest:
            return GLES20.GL_NEAREST;
        default:
            throw new UnsupportedOperationException("Unknown mag filter: " + filter);
    }
}